Skip to content

feat: don't refresh page after wallet reset on web #3306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/composables/transactionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function useTransactionList({
...transactionsLoaded.value,
]);

function resetState() {
function resetTransactionListState() {
state.value = {
accountAddress,
assetContractId,
Expand Down Expand Up @@ -148,7 +148,7 @@ export function useTransactionList({
async function initializeTransactionListPolling() {
if (!state.value.isInitialLoadDone || !transactionsLoaded.value.length) {
if (state.value.isInitialLoadDone && !transactionsLoaded.value.length) {
resetState();
resetTransactionListState();
}
await loadCurrentPageTransactions();
if (
Expand Down Expand Up @@ -208,7 +208,7 @@ export function useTransactionList({
|| state.value.assetContractId !== assetContractId
|| state.value.networkName !== activeNetwork.value.name
) {
resetState();
resetTransactionListState();
}

return {
Expand All @@ -220,5 +220,6 @@ export function useTransactionList({
loadCurrentPageTransactions,
initializeTransactionListPolling,
stopTransactionListPolling,
resetTransactionListState,
};
}
11 changes: 9 additions & 2 deletions src/popup/components/Modals/ResetWalletModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@
import { defineComponent, PropType } from 'vue';
import { useRouter } from 'vue-router';
import type { RejectCallback, ResolveCallback } from '@/types';
import { IS_MOBILE_APP } from '@/constants';
import { IS_MOBILE_APP, PROTOCOLS } from '@/constants';
import {
useAccounts,
useAeSdk,
useModals,
useNetworks,
usePermissions,
useTransactionList,
useUi,
} from '@/composables';
import { ROUTE_INDEX } from '@/popup/router/routeNames';
Expand Down Expand Up @@ -98,13 +99,20 @@ export default defineComponent({
const { resetPermissions } = usePermissions();
const { closeAllModals } = useModals();

const { resetTransactionListState } = useTransactionList({
protocol: PROTOCOLS.aeternity,
accountAddress: null as any, // `any` use deliberately to force setting empty state
});

async function onReset() {
resetAccounts();
resetNetworks();
resetUiSettings();
disconnectDapps();
resetPermissions();
closeAllModals();
resetTransactionListState();
resetPermissions();

WalletStorage.clear();
if (IS_MOBILE_APP) {
Expand All @@ -117,7 +125,6 @@ export default defineComponent({
await router.push({ name: ROUTE_INDEX });

props.resolve();
window.location.reload();
}

return {
Expand Down
Loading