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

DevTools: Flag "nested updates" in the Profiler UI #20236

Closed
bvaughn opened this issue Nov 12, 2020 · 4 comments
Closed

DevTools: Flag "nested updates" in the Profiler UI #20236

bvaughn opened this issue Nov 12, 2020 · 4 comments
Assignees
Labels
Component: Developer Tools Resolution: Stale Automatically closed due to inactivity

Comments

@bvaughn
Copy link
Contributor

bvaughn commented Nov 12, 2020

PR #20163 added a new (not yet released) phase to the Profiler API: "nested-update". This phase is different from a regular "update" because of the performance implications (see PR description for more background info).

Would be nice if we could also flag these in the DevTools UI somehow.

@markerikson
Copy link
Contributor

purely as a reminder/FYI, React-Redux has always relied on this kind of a pattern to ensure top-down updates in connect.

useSelector doesn't do that, but that means it suffers from the potential "stale props" and "zombie child" concerns:

https://react-redux.js.org/api/hooks#stale-props-and-zombie-children

no idea how that will end up changing with useMutableSource down the road.

@bvaughn
Copy link
Contributor Author

bvaughn commented Nov 13, 2020

useSubscription and useMutableSource both check for changes in a passive effect, to avoid stretching the commit phase. It may seem more intuitive to use a layout effect so that you don't "miss" an update but it wouldn't actually guarantee that in concurrent mode, because you might miss an update during render (e.g. while React has yielded).

One important thing useMutableSource does is ensure that nothing tears within the render – so even if you "miss" an update between render and commit, it will catch it later (during passive effects phase) and schedule an update for it. No big deal so long as nothing tears during the render (which it has checks to prevent). If something would tear during the render, useMutableSource throws and forces React to restart the render.

Copy link

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

@github-actions github-actions bot added the Resolution: Stale Automatically closed due to inactivity label Apr 10, 2024
Copy link

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Developer Tools Resolution: Stale Automatically closed due to inactivity
Projects
None yet
Development

No branches or pull requests

2 participants