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(sanity): throw a better error if onChange called during initial render #8165

Merged
merged 1 commit into from
Jan 3, 2025

Conversation

bjoerge
Copy link
Member

@bjoerge bjoerge commented Jan 3, 2025

Description

If an input component calls onChange() during the initial render cycle a quite unhelpful error will be thrown currently.

This PR improves the error message, providing developers with a more precise description of the issue.

What to review

Does the wording make sense?

Testing

n/a - no code paths are changed

Notes for release

n/a

@bjoerge bjoerge requested a review from a team as a code owner January 3, 2025 11:01
@bjoerge bjoerge requested review from ryanbonial and removed request for a team January 3, 2025 11:01
Copy link

vercel bot commented Jan 3, 2025

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 Jan 3, 2025 11:01am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2025 11:01am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2025 11:01am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 3, 2025 11:01am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Jan 3, 2025 11:01am

@bjoerge bjoerge requested a review from pedrobonamin January 3, 2025 11:01
Copy link
Contributor

github-actions bot commented Jan 3, 2025

No changes to documentation

Copy link
Contributor

github-actions bot commented Jan 3, 2025

Component Testing Report Updated Jan 3, 2025 11:11 AM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 3s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 38s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 51s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 25s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 14s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 1m 6s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 27s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 38s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 12s 3 9 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 25s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 42s 21 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

Copy link
Contributor

github-actions bot commented Jan 3, 2025

⚡️ Editor Performance Report

Updated Fri, 03 Jan 2025 11:13:43 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 25.0 efps (40ms) 23.8 efps (42ms) +2ms (+5.0%)
article (body) 65.1 efps (15ms) 62.9 efps (16ms) +1ms (-/-%)
article (string inside object) 26.3 efps (38ms) 25.6 efps (39ms) +1ms (+2.6%)
article (string inside array) 23.8 efps (42ms) 23.3 efps (43ms) +1ms (+2.4%)
recipe (name) 50.0 efps (20ms) 55.6 efps (18ms) -2ms (-10.0%)
recipe (description) 58.8 efps (17ms) 62.5 efps (16ms) -1ms (-5.9%)
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (5ms) -1ms (-/-%)
synthetic (title) 18.7 efps (54ms) 20.0 efps (50ms) -4ms (-6.5%)
synthetic (string inside object) 20.0 efps (50ms) 20.4 efps (49ms) -1ms (-2.0%)

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) 40ms 60ms 70ms 455ms 918ms 11.9s
article (body) 15ms 18ms 25ms 197ms 217ms 5.4s
article (string inside object) 38ms 43ms 50ms 201ms 211ms 6.8s
article (string inside array) 42ms 44ms 50ms 174ms 140ms 6.9s
recipe (name) 20ms 22ms 25ms 41ms 0ms 7.5s
recipe (description) 17ms 19ms 21ms 40ms 0ms 4.5s
recipe (instructions) 6ms 8ms 9ms 18ms 0ms 3.2s
synthetic (title) 54ms 58ms 64ms 483ms 796ms 18.1s
synthetic (string inside object) 50ms 52ms 59ms 276ms 401ms 8.1s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 42ms 56ms 66ms 402ms 748ms 11.3s
article (body) 16ms 18ms 26ms 74ms 212ms 5.5s
article (string inside object) 39ms 43ms 52ms 192ms 231ms 7.0s
article (string inside array) 43ms 44ms 52ms 164ms 147ms 7.2s
recipe (name) 18ms 19ms 21ms 41ms 0ms 6.6s
recipe (description) 16ms 17ms 20ms 35ms 0ms 4.3s
recipe (instructions) 5ms 6ms 8ms 80ms 0ms 3.2s
synthetic (title) 50ms 52ms 56ms 128ms 111ms 11.6s
synthetic (string inside object) 49ms 52ms 56ms 300ms 365ms 8.5s

📚 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.

@bjoerge bjoerge added this pull request to the merge queue Jan 3, 2025
Merged via the queue into next with commit 3285312 Jan 3, 2025
57 checks passed
@bjoerge bjoerge deleted the improve-error branch January 3, 2025 11:18
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.

2 participants