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): allow patching via handleChange in Create-linked documents #8691

Merged
merged 1 commit into from
Feb 18, 2025

Conversation

juice49
Copy link
Contributor

@juice49 juice49 commented Feb 18, 2025

Description

Patches submitted to the handleChange provided by DocumentPaneProvider are currently disallowed when the document is in a read-only state. This renders it impossible to unlink a Create-linked document, which relies on a patch being created programmatically.

This branch sidesteps the issue by excluding Create-linked documents from the read-only check.

What to review

  • handleChange may now patch any part of a Create-link document that would otherwise be read-only. Is this acceptable?

Testing

Unlink a Create-linked document.

Notes for release

Fixes a bug preventing Sanity Create documents from being unlinked.

Copy link

vercel bot commented Feb 18, 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 Feb 18, 2025 0:25am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 18, 2025 0:25am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 18, 2025 0:25am
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Feb 18, 2025 0:25am
test-next-studio ⬜️ Ignored (Inspect) Feb 18, 2025 0:25am

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Feb 18, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.94% 54807 / 127626
🔵 Statements 42.94% 54807 / 127626
🔵 Functions 48.08% 2788 / 5798
🔵 Branches 79.43% 10607 / 13353
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/structure/panes/document/DocumentPaneProvider.tsx 2.53% 100% 100% 2.53% 83-935
Generated in workflow #30634 for commit a735619 by the Vitest Coverage Report Action

@juice49 juice49 force-pushed the fix/create-unlink-readonly-document branch from 771403a to a735619 Compare February 18, 2025 12:18
Copy link
Contributor

github-actions bot commented Feb 18, 2025

⚡️ Editor Performance Report

Updated Tue, 18 Feb 2025 12:30:36 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 27.4 efps (37ms) 26.3 efps (38ms) +2ms (+4.1%)
article (body) 85.5 efps (12ms) 78.4 efps (13ms) +1ms (-/-%)
article (string inside object) 27.8 efps (36ms) 27.8 efps (36ms) +0ms (-/-%)
article (string inside array) 25.0 efps (40ms) 24.4 efps (41ms) +1ms (+2.5%)
recipe (name) 52.6 efps (19ms) 55.6 efps (18ms) -1ms (-5.3%)
recipe (description) 62.5 efps (16ms) 62.5 efps (16ms) +0ms (-/-%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (5ms) +0ms (-/-%)
synthetic (title) 20.2 efps (50ms) 19.4 efps (52ms) +2ms (+4.0%)
synthetic (string inside object) 19.6 efps (51ms) 20.0 efps (50ms) -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) 37ms 40ms 46ms 399ms 131ms 11.0s
article (body) 12ms 14ms 16ms 81ms 64ms 5.1s
article (string inside object) 36ms 37ms 40ms 213ms 120ms 6.8s
article (string inside array) 40ms 44ms 49ms 62ms 262ms 6.8s
recipe (name) 19ms 21ms 23ms 45ms 0ms 6.7s
recipe (description) 16ms 16ms 18ms 34ms 0ms 4.3s
recipe (instructions) 5ms 7ms 8ms 10ms 0ms 3.0s
synthetic (title) 50ms 53ms 63ms 347ms 817ms 12.9s
synthetic (string inside object) 51ms 53ms 57ms 385ms 1192ms 8.1s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 38ms 41ms 49ms 306ms 306ms 10.4s
article (body) 13ms 14ms 15ms 199ms 287ms 5.0s
article (string inside object) 36ms 40ms 44ms 136ms 151ms 6.5s
article (string inside array) 41ms 43ms 44ms 139ms 140ms 6.5s
recipe (name) 18ms 20ms 22ms 44ms 0ms 7.1s
recipe (description) 16ms 18ms 19ms 32ms 0ms 4.4s
recipe (instructions) 5ms 7ms 8ms 15ms 0ms 3.0s
synthetic (title) 52ms 56ms 77ms 327ms 1075ms 13.0s
synthetic (string inside object) 50ms 54ms 58ms 357ms 1240ms 8.3s

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

@juice49 juice49 requested a review from bjoerge February 18, 2025 12:19
@juice49 juice49 changed the title fix(sanity): accept patches to read-only Create-linked documents fix(sanity): allow patching via handleChange in Create-linked documents Feb 18, 2025
@juice49 juice49 marked this pull request as ready for review February 18, 2025 12:20
@juice49 juice49 requested a review from a team as a code owner February 18, 2025 12:20
Copy link
Contributor

github-actions bot commented Feb 18, 2025

Component Testing Report Updated Feb 18, 2025 12:34 PM (UTC)

❌ Failed Tests (5) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 11s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 15s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ❌ Failed (Inspect) 2m 43s 3 0 3
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 59s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 30s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 17s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 31s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ❌ Failed (Inspect) 1m 56s 14 0 1
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 54s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ❌ Failed (Inspect) 3m 0s 20 0 1
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 15s 3 9 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 32s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 2m 1s 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

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