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
This commit is contained in:
Alex Rudenko 2022-08-22 16:51:58 +02:00 committed by GitHub
parent b9b24cf963
commit 341b669a5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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();