Skip to content

Commit

Permalink
fix(fsm): call render states function in there own this
Browse files Browse the repository at this point in the history
  • Loading branch information
AliMD committed Apr 19, 2023
1 parent 2d4e694 commit a950478
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/fsm/src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ export const defineInstanceSignals = <T extends FsmTypeHelper>(
export const render = <TState extends string = string>(
instanceId: string,
states: {[P in TState]: (() => unknown) | TState},
thisArg: unknown = null,
): unknown => {
const state = getFsmInstance(instanceId).state;
logger.logMethodArgs?.('render', {instanceId, state: state.target});
Expand All @@ -372,7 +373,7 @@ export const render = <TState extends string = string>(
}

if (typeof renderFn === 'function') {
return renderFn();
return renderFn.call(thisArg);
}

return;
Expand Down

0 comments on commit a950478

Please sign in to comment.