mirror of
https://github.com/discourse/discourse.git
synced 2025-02-26 07:38:40 +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.
|
* 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;
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user