Skip to content

Commit

Permalink
fix: cache loaded transactions if state did not change
Browse files Browse the repository at this point in the history
  • Loading branch information
martinkaintas committed Mar 6, 2024
1 parent 94f6e0d commit c112a22
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/composables/transactionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,21 @@ export function useTransactionList({
const { activeNetwork } = useNetworks();
const { accountsTransactionsPending } = useLatestTransactionList();

state.value = {
accountAddress,
assetContractId,
isEndReached: false,
isInitialLoadDone: false,
networkName: activeNetwork.value.name,
nextPagePaginationParams: {},
transactionsLoaded: [],
};
if (
state.value.accountAddress !== accountAddress
|| state.value.assetContractId !== assetContractId
|| state.value.networkName !== activeNetwork.value.name
) {
state.value = {
accountAddress,
assetContractId,
isEndReached: false,
isInitialLoadDone: false,
networkName: activeNetwork.value.name,
nextPagePaginationParams: {},
transactionsLoaded: [],
};
}

const adapter = ProtocolAdapterFactory.getAdapter(protocol);

Expand Down

0 comments on commit c112a22

Please sign in to comment.