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: opt-out @tanstack/react-virtual from React Compiler #7891

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

stipsan
Copy link
Member

@stipsan stipsan commented Nov 27, 2024

Description

Adding React Compiler caused a regression in paths that uses import {useVirtualizer} from '@tanstack/react-virtual'. It's a known issue, and I've subscribed to the issue so I get notified when we can come back and remove the 'use no memo' directives 👍

What to review

This should fix SAPP-1945, repro: https://test-studio.sanity.dev/test/structure/input-standard;arraysTest;18db9a51-b3fe-4843-94a6-c5a2ba6ac039

Testing

Didn't have time to add an E2E test that covers this case, but it might be worth doing in a follow-up 🙌 Manually tested by checking http://localhost:3333/test/structure/input-standard;arraysTest;18db9a51-b3fe-4843-94a6-c5a2ba6ac039 and scrolling, verifying that array reference items render without focusing/clicking first.

Notes for release

Fixes a regression introduced in v3.65.0 where array list references rendered far too lazily, and required focus or clicking, when initially "below the fold" of the browser window. They now correctly render on scroll ✨

@stipsan stipsan requested a review from a team as a code owner November 27, 2024 14:17
@stipsan stipsan requested review from pedrobonamin and removed request for a team November 27, 2024 14:17
Copy link

vercel bot commented Nov 27, 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 Nov 27, 2024 2:28pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2024 2:28pm
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2024 2:28pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2024 2:28pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Nov 27, 2024 2:28pm

Copy link
Contributor

No changes to documentation

Copy link
Contributor

@RitaDias RitaDias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did some testing myself, this seems to work as expected 🙏
Thanks Cody

Copy link
Contributor

Component Testing Report Updated Nov 27, 2024 2:23 PM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 47s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 31s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 39s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 2m 33s 1 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 48s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 51s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 19s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 9s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 26s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 19s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 37s 12 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

@stipsan stipsan added this pull request to the merge queue Nov 27, 2024
Merged via the queue into next with commit db5495b Nov 27, 2024
55 checks passed
@stipsan stipsan deleted the opt-out-react-virtual-from-memo branch November 27, 2024 14:28
Copy link
Contributor

⚡️ Editor Performance Report

Updated Wed, 27 Nov 2024 14:29:44 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 22.2 efps (45ms) 20.0 efps (50ms) +5ms (+11.1%)
article (body) 56.2 efps (18ms) 53.5 efps (19ms) +1ms (+5.1%)
article (string inside object) 24.4 efps (41ms) 23.8 efps (42ms) +1ms (+2.4%)
article (string inside array) 21.7 efps (46ms) 20.8 efps (48ms) +2ms (+4.3%)
recipe (name) 47.6 efps (21ms) 47.6 efps (21ms) +0ms (-/-%)
recipe (description) 55.6 efps (18ms) 55.6 efps (18ms) +0ms (-/-%)
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (6ms) +0ms (-/-%)
synthetic (title) 17.2 efps (58ms) 16.9 efps (59ms) +1ms (+1.7%)
synthetic (string inside object) 17.2 efps (58ms) 16.9 efps (59ms) +1ms (+1.7%)

efps — editor "frames per second". The number of updates assumed to be possible within a second.

Derived from input latency. efps = 1000 / input_latency

Detailed information

🏠 Reference result

The performance result of sanity@latest

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 45ms 48ms 55ms 267ms 292ms 12.1s
article (body) 18ms 20ms 30ms 146ms 287ms 6.2s
article (string inside object) 41ms 44ms 52ms 186ms 165ms 7.1s
article (string inside array) 46ms 48ms 61ms 186ms 177ms 7.7s
recipe (name) 21ms 22ms 26ms 44ms 0ms 7.3s
recipe (description) 18ms 19ms 20ms 36ms 0ms 4.6s
recipe (instructions) 6ms 8ms 9ms 15ms 0ms 3.2s
synthetic (title) 58ms 64ms 68ms 354ms 874ms 14.3s
synthetic (string inside object) 58ms 63ms 66ms 387ms 810ms 8.6s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 50ms 54ms 66ms 188ms 215ms 12.3s
article (body) 19ms 20ms 28ms 74ms 243ms 5.9s
article (string inside object) 42ms 45ms 62ms 99ms 153ms 7.4s
article (string inside array) 48ms 51ms 54ms 159ms 170ms 7.4s
recipe (name) 21ms 23ms 25ms 41ms 0ms 7.0s
recipe (description) 18ms 21ms 22ms 36ms 0ms 4.6s
recipe (instructions) 6ms 8ms 9ms 10ms 0ms 3.2s
synthetic (title) 59ms 61ms 66ms 94ms 467ms 13.7s
synthetic (string inside object) 59ms 64ms 76ms 444ms 1269ms 9.4s

📚 Glossary

column definitions

  • benchmark — the name of the test, e.g. "article", followed by the label of the field being measured, e.g. "(title)".
  • latency — the time between when a key was pressed and when it was rendered. derived from a set of samples. the median (p50) is shown to show the most common latency.
  • p75 — the 75th percentile of the input latency in the test run. 75% of the sampled inputs in this benchmark were processed faster than this value. this provides insight into the upper range of typical performance.
  • p90 — the 90th percentile of the input latency in the test run. 90% of the sampled inputs were faster than this. this metric helps identify slower interactions that occurred less frequently during the benchmark.
  • p99 — the 99th percentile of the input latency in the test run. only 1% of sampled inputs were slower than this. this represents the worst-case scenarios encountered during the benchmark, useful for identifying potential performance outliers.
  • blocking time — the total time during which the main thread was blocked, preventing user input and UI updates. this metric helps identify performance bottlenecks that may cause the interface to feel unresponsive.
  • test duration — how long the test run took to complete.

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.

3 participants