Skip to content

Commit

Permalink
Revert "fix: contextDidChange should be called for each action"
Browse files Browse the repository at this point in the history
This reverts commit 2e92385.
  • Loading branch information
tdreyno committed Apr 18, 2022
1 parent d416c97 commit 63c4f33
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export class Runtime {
}

await promise

this.#contextDidChange()
}

async #processQueueHead(): Promise<void> {
Expand Down Expand Up @@ -201,16 +203,10 @@ export class Runtime {
// const prefix = isEnteringNewState
// ? this.enterState_(targetState, exitState)
// : []
const prefix = [
// Add a log effect.
log(`Action: ${action.type as string}`, action.payload),
]

const result = await targetState.executor(action)

this.#contextDidChange()

return [...prefix, ...arraySingleton(result)]
return arraySingleton(result)
}

#handleState(targetState: StateTransition<any, any, any>): StateReturn[] {
Expand Down Expand Up @@ -253,6 +249,12 @@ export class Runtime {

// Run enter on next state
enter(),

// Notify listeners of change
// effect("contextChange", undefined, () => {
// // Only state changes (and updates) can change context
// this.onContextChange_()
// }),
]

// Run exit on prior state first
Expand Down

0 comments on commit 63c4f33

Please sign in to comment.