Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
adonesky1 committed Sep 24, 2024
1 parent f9cfe42 commit a907d3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ describe('QueuedRequestController', () => {
},
jest.fn(),
),
).rejects.toThrow('switch error');
).rejects.toThrow(switchError);
});

it('correctly processes the next item in the queue', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ export class QueuedRequestController extends BaseController<
);
}

// Note: since we're using queueing for multichain requests to start, this flush could incorrectly flush
// multichain requests if the user switches networks on a dapp while multichain request is in the queue.
// we intend to remove queueing for multichain requests in the future, so for now we have to live with this.
#flushQueueForOrigin(flushOrigin: string) {
this.#requestQueue
.filter(({ origin }) => origin === flushOrigin)
Expand Down Expand Up @@ -287,9 +290,6 @@ export class QueuedRequestController extends BaseController<
* `networkClientId` on the request are invalid.
*/
async #switchNetworkIfNecessary(requestNetworkClientId: NetworkClientId) {
if (!this.#originOfCurrentBatch) {
throw new Error('Current batch origin must be initialized first');
}
const { selectedNetworkClientId } = this.messagingSystem.call(
'NetworkController:getState',
);
Expand Down

0 comments on commit a907d3d

Please sign in to comment.