mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 21:02:48 +08:00
FIX: Stick to then/finally in history-store (#30061)
async/await doesn't play well with transitions (to be investigated… later)
This commit is contained in:
parent
c3e87b5036
commit
48323230a4
|
@ -111,7 +111,7 @@ export default class HistoryStore extends Service {
|
|||
* not available as an event on the router service.
|
||||
*/
|
||||
@bind
|
||||
async willResolveModel(transition) {
|
||||
willResolveModel(transition) {
|
||||
if (HANDLED_TRANSITIONS.has(transition)) {
|
||||
return;
|
||||
}
|
||||
|
@ -141,16 +141,16 @@ export default class HistoryStore extends Service {
|
|||
}
|
||||
|
||||
this.#pendingStore = pendingStoreForThisTransition;
|
||||
|
||||
try {
|
||||
await transition;
|
||||
this.#uuid = window.history.state?.uuid;
|
||||
this.#routeData.set(this.#uuid, this.#pendingStore);
|
||||
this.#pruneOldData();
|
||||
} finally {
|
||||
if (pendingStoreForThisTransition === this.#pendingStore) {
|
||||
this.#pendingStore = null;
|
||||
}
|
||||
}
|
||||
transition
|
||||
.then(() => {
|
||||
this.#uuid = window.history.state?.uuid;
|
||||
this.#routeData.set(this.#uuid, this.#pendingStore);
|
||||
this.#pruneOldData();
|
||||
})
|
||||
.finally(() => {
|
||||
if (pendingStoreForThisTransition === this.#pendingStore) {
|
||||
this.#pendingStore = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user