Skip to content

Commit

Permalink
fix: call stateChanged with new state already applied
Browse files Browse the repository at this point in the history
  • Loading branch information
arlac77 committed Aug 1, 2022
1 parent d59c12b commit 36e4bc1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/statetransition-mixin.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,10 @@ export function StateTransitionMixin(superclass, actions, initialState) {
* @return {void}
*/
set state(newState) {
if (newState !== this[STATE]) {
this.stateChanged(this, this[STATE], newState);
const oldState = this[STATE];
if (newState !== oldState) {
this[STATE] = newState;
this.stateChanged(this, oldState, newState);
}
}
};
Expand Down

0 comments on commit 36e4bc1

Please sign in to comment.