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(performance): allow Synchronizer to be compiled #327

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

stipsan
Copy link
Member

@stipsan stipsan commented Oct 31, 2024

Resolves this warning:

Ref values (the `current` property) may not be accessed during render. (https://react.dev/reference/react/useRef)

Which is thrown because onFlushPendingPatchesThrottled, wrapped in useMemo, is calling onFlushPendingPatches‎(), which is using a reference.
This is technically a false negative by the compiler, but seeing that onFlushPendingPatchesThrottled is only needed and used by a single useEffect it makes sense to move it in there anyway, making it obvious to the compiler that onFlushPendingPatchesThrottled is never called during render and can use any useRef instances safely.
Reported to the team here.

Copy link

vercel bot commented Oct 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
portable-text-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 1, 2024 0:37am

@stipsan stipsan force-pushed the refactor-synchronizer branch from dc3710f to 8e49bea Compare November 1, 2024 12:36
@stipsan stipsan requested a review from christianhg November 1, 2024 12:36
@stipsan stipsan marked this pull request as ready for review November 1, 2024 12:36
@stipsan stipsan mentioned this pull request Nov 1, 2024
4 tasks
@stipsan stipsan merged commit 1a086f0 into main Nov 1, 2024
12 checks passed
@stipsan stipsan deleted the refactor-synchronizer branch November 1, 2024 12:57
@ecoscript ecoscript bot mentioned this pull request Nov 1, 2024
This was referenced Nov 26, 2024
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.

1 participant