Skip to content

fix(useRafCallback): preserve cancellation of reentrant frames - #1730

Open
feritcemkahraman wants to merge 1 commit into
react-hookz:masterfrom
feritcemkahraman:fix/raf-reentrant-cancellation
Open

feritcemkahraman wants to merge 1 commit into
react-hookz:masterfrom
feritcemkahraman:fix/raf-reentrant-cancellation

Conversation

@feritcemkahraman

Copy link
Copy Markdown

What does this PR do?

Fixes cancellation when a useRafCallback callback schedules its next frame. The completed callback currently clears the newly scheduled frame ID, so cancelling or unmounting after the first frame still lets the second callback run.

Clear the completed frame ID before invoking the callback, preserving any frame scheduled during that invocation.

Validation

  • Added two regressions for explicit cancellation and unmount after reentrant scheduling; both fail before the fix and pass afterward.
  • Full test suite: 534 tests passed across 117 files.
  • yarn lint, yarn typecheck, and yarn build passed.
  • Changed files formatted with vp fmt.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant