From 341b669a5e45ecbb9ffb0f28c45b520660f27ad2 Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Mon, 22 Aug 2022 16:51:58 +0200 Subject: [PATCH] fix: allow multiple navigations to happen in LifecycleWatcher (#8826) 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();