Skip to content

Commit fa2dc5c

Browse files
committed
feat: add state symbol id field
1 parent 9871594 commit fa2dc5c

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

src/background/model/background-app.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ export class BackgroundApp {
8686
const nextState = index.get(id);
8787
if (nextState) {
8888
let state: State | null = nextState.stateFactory();
89-
if (lastState instanceof state.constructor) {
89+
if (lastState instanceof state.constructor &&
90+
lastState.stateSymbolId === state.stateSymbolId) {
9091
state = lastState.nextState(id);
9192
}
9293
if (state) {

src/background/states/state.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ export abstract class State {
1313
abstract nextState(id: string): State | null;
1414

1515
destroy() {};
16+
17+
get stateSymbolId() {
18+
return this.symbolId;
19+
}
1620
}

src/ui/model/state-manager.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@ export class StateManager {
4343
if (!this.transitionInProgress) {
4444
this.transitionInProgress = id;
4545
}
46-
if (this.lastTransition === id) {
47-
const last = this.history[this.history.length - 1];
48-
this.transitionInProgress = null;
49-
return Promise.resolve(last);
50-
}
46+
// Not really required because of the logic in directStateTransfer in the background app
47+
// if (this.lastTransition === id) {
48+
// const last = this.history[this.history.length - 1];
49+
// this.transitionInProgress = null;
50+
// return Promise.resolve(last);
51+
// }
5152
return (!isMetaNodeId(id) ?
5253
this.state.directStateTransfer(id) :
5354
this.state.nextState(id))

0 commit comments

Comments
 (0)