Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wait next frame on playin #9

Merged
merged 2 commits into from May 25, 2022
Merged

Conversation

willybrauner
Copy link
Member

@willybrauner willybrauner commented May 25, 2022

Problem:

The parent component mount the component using a TransitionsManager instance :

const App = () => {
  const childIsMount = useIsMount(Child.transitionManager);
  return {childIsMount && <Child />}
}

The child can listen playStateSignal only on after being mounted with usePlayIn hook.

usePlayIn(Child.transitionsManager, async (done) => {
    // here, the "playStateSignal" handler content
    // this code is executed when the manager dispatch "play-in" state
  })

But sometimes the component start to listening after the TransitionManager instance dispatch "play-in" state. The child didn't catch this first dispatch and playIn is never fired.

This MR just Add a "next frame" hake in order to wait the child component will be rendered BEFORE the "play-in" state will be dispatched by the manager.

@willybrauner willybrauner merged commit e1f5940 into main May 25, 2022
@willybrauner willybrauner deleted the fix/wait-next-frame-on-play-in branch June 13, 2022 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant