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(vision): simplify perspective handling, no default perspective #8516

Open
wants to merge 3 commits into
base: next
Choose a base branch
from

Conversation

bjoerge
Copy link
Member

@bjoerge bjoerge commented Feb 5, 2025

Description

This adds some smaller changes to Vision as part of the upcoming default perspective change (from raw => published):

  • Currently, raw is selected as the default. With these changes, the default becomes "unspecified" (i.e. no perspective param is sent with the request, effecively using the default for the given API version). I can imagine this can be useful for debugging. This also means published will soon become the default.
  • In accordance with the above, it should then also be possible to select “No perspective” from the dropdown.
  • With these changes, you'll get today’s date as the default API version. Currently, we’re using the last element in a hard coded array of dates. This means you'll get v2022-03-07 at the moment, and chances are you'll be given an outdated default until we remember to update this list. I can’t think of any issue with using a rolling date here. The default can always be customized on a per-studio basis if that's desirable. Let me know if I've missed a reason we should keep it hard coded.

What to review

Note: This is is ready for review, but not yet ready to merge.

Testing

Tests in this repo is sparse, so please look at the code and give it a go in the preview build.

Notes for release

n/a

Copy link

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

Copy link
Contributor

github-actions bot commented Feb 5, 2025

No changes to documentation

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.38% 53663 / 126606
🔵 Statements 42.38% 53663 / 126606
🔵 Functions 47.84% 2763 / 5775
🔵 Branches 78.77% 10276 / 13044
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/@sanity/vision/src/apiVersions.ts 0% 0% 0% 0% 1-9
packages/@sanity/vision/src/perspectives.ts 0% 0% 0% 0% 1-34
packages/@sanity/vision/src/components/PerspectivePopover.tsx 0% 0% 0% 0% 1-94
packages/@sanity/vision/src/components/VisionGui.tsx 0% 0% 0% 0% 1-1151
packages/@sanity/vision/src/i18n/resources.ts 0% 0% 0% 0% 1-93
Generated in workflow #29886 for commit 253151c by the Vitest Coverage Report Action

Copy link
Contributor

github-actions bot commented Feb 5, 2025

Component Testing Report Updated Feb 5, 2025 5:35 PM (UTC)

❌ Failed Tests (1) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 4s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ❌ Failed (Inspect) 1m 20s 5 0 1
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 52s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 14s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 27s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 1m 7s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 30s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 2m 3s 21 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 13s 3 9 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 26s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 44s 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 Feb 5, 2025

⚡️ Editor Performance Report

Updated Wed, 05 Feb 2025 17:37:52 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 22.2 efps (45ms) 23.8 efps (42ms) -3ms (-6.7%)
article (body) 67.1 efps (15ms) 67.3 efps (15ms) -0ms (-/-%)
article (string inside object) 22.7 efps (44ms) 24.4 efps (41ms) -3ms (-6.8%)
article (string inside array) 20.8 efps (48ms) 22.2 efps (45ms) -3ms (-6.3%)
recipe (name) 47.6 efps (21ms) 40.0 efps (25ms) +4ms (+19.0%)
recipe (description) 52.6 efps (19ms) 47.6 efps (21ms) +2ms (+10.5%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (5ms) +0ms (-/-%)
synthetic (title) 17.4 efps (58ms) 18.9 efps (53ms) -5ms (-7.8%)
synthetic (string inside object) 18.3 efps (55ms) 20.0 efps (50ms) -5ms (-8.3%)

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 49ms 70ms 434ms 946ms 11.6s
article (body) 15ms 20ms 32ms 229ms 386ms 5.7s
article (string inside object) 44ms 47ms 54ms 330ms 546ms 8.1s
article (string inside array) 48ms 52ms 64ms 163ms 475ms 7.7s
recipe (name) 21ms 23ms 28ms 53ms 30ms 7.0s
recipe (description) 19ms 21ms 23ms 31ms 0ms 4.6s
recipe (instructions) 5ms 7ms 8ms 30ms 0ms 3.1s
synthetic (title) 58ms 60ms 76ms 294ms 1318ms 13.3s
synthetic (string inside object) 55ms 58ms 69ms 664ms 1821ms 9.6s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 42ms 46ms 71ms 488ms 972ms 12.0s
article (body) 15ms 18ms 22ms 176ms 265ms 5.5s
article (string inside object) 41ms 42ms 45ms 60ms 155ms 7.1s
article (string inside array) 45ms 47ms 54ms 161ms 346ms 7.7s
recipe (name) 25ms 27ms 32ms 54ms 0ms 8.0s
recipe (description) 21ms 22ms 26ms 43ms 15ms 5.1s
recipe (instructions) 5ms 7ms 8ms 24ms 0ms 3.0s
synthetic (title) 53ms 55ms 63ms 315ms 930ms 13.3s
synthetic (string inside object) 50ms 54ms 74ms 465ms 1089ms 8.7s

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

1 participant