Skip to content
Merged
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
4 changes: 4 additions & 0 deletions packages/assets-controller/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- `AccountsApiDataSource` `forceUpdate` balance fetches now use `staleTime`/`gcTime` of `100`ms (previously `0`/`0`) so bursts of near-simultaneous forced refreshes are de-duplicated by TanStack Query into a single Accounts API request instead of one request per trigger ([#9591](https://github.com/MetaMask/core/pull/9591))

## [11.1.1]

### Changed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,15 +377,15 @@ describe('AccountsApiDataSource', () => {
controller.destroy();
});

it('fetch bypasses TanStack cache when forceUpdate is true', async () => {
it('uses a short-lived TanStack cache window when forceUpdate is true', async () => {
const { controller, apiClient } = await setupController();

await controller.fetch(createDataRequest({ forceUpdate: true }));

expect(apiClient.accounts.fetchV5MultiAccountBalances).toHaveBeenCalledWith(
[`eip155:1:${MOCK_ADDRESS}`],
undefined,
{ staleTime: 0, gcTime: 0 },
{ staleTime: 100, gcTime: 100 },
);

controller.destroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ export class AccountsApiDataSource extends AbstractDataSource<
}

const fetchOptions = request.forceUpdate
? { staleTime: 0, gcTime: 0 }
? { staleTime: 100, gcTime: 100 }
: undefined;

// Feature-flagged: v6 endpoint with a fallback to legacy v5. The flag is
Expand Down