Skip to content

A platform for community discussion. Free, open, simple.

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

Jarek Radosz48323230a49d
diff --git a/app/assets/javascripts/discourse/app/services/history-store.js b/app/assets/javascripts/discourse/app/services/history-store.js
index fce92bfa6eb..9a516b037b7 100644
--- a/app/assets/javascripts/discourse/app/services/history-store.js
+++ b/app/assets/javascripts/discourse/app/services/history-store.js
@@ -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;
+ }
+ });
}
}