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

[useEvent] Non-stable function identity #25473

Merged
merged 5 commits into from
Oct 19, 2022
Merged

[useEvent] Non-stable function identity #25473

merged 5 commits into from
Oct 19, 2022

Commits on Oct 19, 2022

  1. [useEvent] Non-stable function identity

    Since useEvent shouldn't go in the dependency list of whatever is
    consuming it (which is enforced by the fact that useEvent functions are
    always locally created and never passed by reference), its identity
    doesn't matter. Effectively, this PR is a runtime assertion
    that you can't rely on the return value of useEvent to be stable.
    poteto committed Oct 19, 2022
    Configuration menu
    Copy the full SHA
    32a6646 View commit details
    Browse the repository at this point in the history
  2. Test: Events should see latest bindings

    The key feature of useEvent that makes it different from useCallback
    is that events always see the latest committed values. There's no such
    thing as a "stale" event handler.
    acdlite authored and poteto committed Oct 19, 2022
    Configuration menu
    Copy the full SHA
    b69bb5d View commit details
    Browse the repository at this point in the history
  3. Fix failing test

    poteto committed Oct 19, 2022
    Configuration menu
    Copy the full SHA
    96ed5e0 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ef85a49 View commit details
    Browse the repository at this point in the history
  5. Inline event function wrapping

    - Inlines wrapping of the callback
    - Use a mutable ref-style object instead of a callable object
    - Fix types
    poteto committed Oct 19, 2022
    Configuration menu
    Copy the full SHA
    c8ab997 View commit details
    Browse the repository at this point in the history