Skip to content

Commit d05e366

Browse files
committed
fix: do not store all the tokens in the localStorage
1 parent 52c1dbd commit d05e366

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/store/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,17 @@ export default createStore({
385385
wallet,
386386
lang,
387387
aeternity: { providedLiquidity, slippage, deadline },
388-
tokens: { userTokens, providers },
388+
// Persist only lightweight provider metadata to avoid localStorage overflow.
389+
// Do NOT persist large token lists; they are fetched on demand.
390+
tokens: {
391+
userTokens,
392+
providers: (providers || []).map(({ name, icon, active }) => ({
393+
name,
394+
icon,
395+
active,
396+
tokens: [],
397+
})),
398+
},
389399
hasSeenOnboarding,
390400
}),
391401
}),

src/store/modules/tokens.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ export default {
103103
actions: {
104104
async fetchAllTokens({ commit, rootGetters: { activeNetwork }, state: { providers } }) {
105105
if (activeNetwork) {
106+
const existingProvider = providers.find((p) => p.name === 'AE Middleware List');
107+
const hasTokensForNetwork = existingProvider?.tokens?.some(
108+
(t) => t.networkId === activeNetwork.networkId,
109+
);
110+
if (hasTokensForNetwork) return;
106111
const tokens = await fetchAllPages(
107112
() =>
108113
fetchJson(`${activeNetwork.middlewareUrl}/v3/aex9?by=name&limit=100&direction=forward`),

0 commit comments

Comments
 (0)