Skip to content

Commit 82bad02

Browse files
committed
fix(uiCanExit): removed setTimeout wrapper of hook registration
Remove setTimeout wrapper for registerUiCanExitHook and move it to the node ref function. The setTimeout is preventing the hook to be registered if the state is entered and exited synchronously.
1 parent befc6a0 commit 82bad02

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/UIView.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,13 @@ export class UIView extends Component<IProps, IState> {
6363
let { children } = this.props;
6464
let { component, props, loaded } = this.state;
6565
// register reference of child component
66-
props.ref = c => this.componentInstance = c;
6766
// register new hook right after component has been rendered
6867
let stateName: string = this.uiViewAddress && this.uiViewAddress.context && this.uiViewAddress.context.name;
69-
setTimeout(() => this.registerUiCanExitHook(stateName));
68+
props.ref = c => {
69+
this.componentInstance = c;
70+
this.registerUiCanExitHook(stateName);
71+
};
72+
7073
let child = !loaded && isValidElement(children)
7174
? cloneElement(children, props)
7275
: createElement(component, props);

0 commit comments

Comments
 (0)