From 1b588dca9fa3daf9f388678690e0364240e2913e Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Mon, 22 Aug 2022 14:14:51 +0200 Subject: [PATCH] fix: allow multiple navigations to happen in LifecycleWatcher There is no repro but it looks like sometimes the backend reports two navigation requests. This PR changes the logic to allow that instead of failing as it seems that failing is a bigger issue than handling multiple navigation requests. Closes #8811 --- src/common/LifecycleWatcher.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/LifecycleWatcher.ts b/src/common/LifecycleWatcher.ts index b13f70218575c..b68e22dcd4e96 100644 --- a/src/common/LifecycleWatcher.ts +++ b/src/common/LifecycleWatcher.ts @@ -179,9 +179,10 @@ export class LifecycleWatcher { return; } this.#navigationRequest = request; - this.#navigationResponseReceived?.reject( - new Error('New navigation request was received') - ); + // Resolve previous navigation response in case there are multiple + // navigation requests reported by the backend. This generally should not + // happen by it looks like it's possible. + this.#navigationResponseReceived?.resolve(); this.#navigationResponseReceived = createDeferredPromise(); if (request.response() !== null) { this.#navigationResponseReceived?.resolve();