Skip to content

Commit

Permalink
chore: Cleanup single return update of fetchTokenList
Browse files Browse the repository at this point in the history
  • Loading branch information
gambinish committed Oct 31, 2024
1 parent f1d1588 commit 31b15e6
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions packages/assets-controllers/src/TokenListController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,18 +323,17 @@ export class TokenListController extends StaticIntervalPollingController<TokenLi
}

// Update the state with a single update for both tokenList and tokenChainsCache
const updatedTokensChainsCache: TokensChainsCache = {
...tokensChainsCache,
[chainId]: {
timestamp: Date.now(),
data: tokenList,
},
};
this.update(() => {
return {
...this.state,
tokenList,
tokensChainsCache: updatedTokensChainsCache,
tokensChainsCache: {
...tokensChainsCache,
[chainId]: {
timestamp: Date.now(),
data: tokenList,
},
},
};
});
} finally {
Expand Down

0 comments on commit 31b15e6

Please sign in to comment.