FIX: Stick to then/finally in history-store ()

async/await doesn't play well with transitions (to be investigated… later)
This commit is contained in:
Jarek Radosz 2024-12-03 14:13:26 +01:00 committed by GitHub
parent c3e87b5036
commit 48323230a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -111,7 +111,7 @@ export default class HistoryStore extends Service {
* not available as an event on the router service. * not available as an event on the router service.
*/ */
@bind @bind
async willResolveModel(transition) { willResolveModel(transition) {
if (HANDLED_TRANSITIONS.has(transition)) { if (HANDLED_TRANSITIONS.has(transition)) {
return; return;
} }
@ -141,16 +141,16 @@ export default class HistoryStore extends Service {
} }
this.#pendingStore = pendingStoreForThisTransition; this.#pendingStore = pendingStoreForThisTransition;
transition
try { .then(() => {
await transition; this.#uuid = window.history.state?.uuid;
this.#uuid = window.history.state?.uuid; this.#routeData.set(this.#uuid, this.#pendingStore);
this.#routeData.set(this.#uuid, this.#pendingStore); this.#pruneOldData();
this.#pruneOldData(); })
} finally { .finally(() => {
if (pendingStoreForThisTransition === this.#pendingStore) { if (pendingStoreForThisTransition === this.#pendingStore) {
this.#pendingStore = null; this.#pendingStore = null;
} }
} });
} }
} }