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

Fix useId in strict mode #22681

Merged
merged 2 commits into from
Nov 3, 2021
Merged

Commits on Nov 2, 2021

  1. Fix: useId in strict mode

    In strict mode, `renderWithHooks` is called twice to flush out
    side effects.
    
    Modying the tree context (`pushTreeId` and `pushTreeFork`) is effectful,
    so before this fix, the tree context was allocating two slots for a
    materialized id instead of one.
    
    To address, I lifted those calls outside of `renderWithHooks`. This
    is how I had originally structured it, and it's how Fizz is structured,
    too. The other solution would be to reset the stack in between the calls
    but that's also a bit weird because we usually only ever reset the
    stack during unwind or complete.
    acdlite committed Nov 2, 2021
    Configuration menu
    Copy the full SHA
    de5f63f View commit details
    Browse the repository at this point in the history
  2. Add test for render phase updates

    Noticed this while fixing the previous bug
    acdlite committed Nov 2, 2021
    Configuration menu
    Copy the full SHA
    23372a5 View commit details
    Browse the repository at this point in the history