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

refactor: change memoization of margins to support the rule of hooks #6875

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

stipsan
Copy link
Member

@stipsan stipsan commented Jun 7, 2024

Description

By destructuring the array, which is guaranteed to always be a [number, number, number, number] tuple, the memoization is no longer violating the rules of hooks by overriding how deps are specified in useMemo. And it no longer calls JSON.stringify on every single render.
Thus it can also be compiled by React Compiler.

What to review

Presence circles should work like before in general, and slightly faster in https://test-compiled-studio.sanity.build

Testing

Existing tests should cover it.

Notes for release

N/A

Copy link

vercel bot commented Jun 7, 2024

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

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2024 8:54am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2024 8:54am
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2024 8:54am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2024 8:54am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 14, 2024 8:54am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Jun 14, 2024 8:54am

Copy link
Contributor

github-actions bot commented Jun 7, 2024

No changes to documentation

Copy link
Contributor

github-actions bot commented Jun 7, 2024

Component Testing Report Updated Jun 14, 2024 8:58 AM (UTC)

File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 35s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 6s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 25s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 30s 11 7 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 29s 4 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 36s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 13s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 4s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 7s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 20s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 14s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 29s 12 0 0

@stipsan stipsan force-pushed the refactor-image-tool-resize branch from 0510d1b to 75d5769 Compare June 10, 2024 09:21
@stipsan stipsan force-pushed the refactor-regision-with-interesect-memoization branch from de2cca0 to ca084e4 Compare June 10, 2024 09:24
@stipsan stipsan force-pushed the refactor-image-tool-resize branch 3 times, most recently from 464b451 to b4eb70d Compare June 12, 2024 18:02
@stipsan stipsan changed the base branch from refactor-image-tool-resize to next June 12, 2024 18:03
@stipsan stipsan force-pushed the refactor-regision-with-interesect-memoization branch 2 times, most recently from 3ee55ba to c19cffb Compare June 12, 2024 18:06
@stipsan stipsan marked this pull request as ready for review June 12, 2024 18:06
@stipsan stipsan requested a review from a team as a code owner June 12, 2024 18:06
@stipsan stipsan requested review from cngonzalez and removed request for a team June 12, 2024 18:07
@stipsan stipsan added this pull request to the merge queue Jun 14, 2024
@juice49
Copy link
Contributor

juice49 commented Jun 14, 2024

Nice! Thanks!

Merged via the queue into next with commit fbf90ec Jun 14, 2024
39 of 43 checks passed
@stipsan stipsan deleted the refactor-regision-with-interesect-memoization branch June 14, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants