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(preview): fix issue with document version indicators not syncing #9040

Merged
merged 3 commits into from
Mar 25, 2025

Conversation

bjoerge
Copy link
Member

@bjoerge bjoerge commented Mar 24, 2025

Description

Currently, the version indicator dots in previews doesn't properly update after a version is created or deleted (i.e. when a document is published, a draft or version is is created or discarded)

This PR fixes it, as seen here:

Screen.Recording.2025-03-24.at.21.08.35.mov

Also added a small util for checking whether a document id matches a provided perspective stack. This is marked as @internal, but exported from the package for consistency with other functions in draftUtils

Additionally made some small tweaks to comments to make it a bit clearer (I hope!)

What to review

Does it make sense?

Testing

Notes for release

  • Fixes an issue causing version indicators to not update when a document is published, or a draft or version is is created or discarded

Verified

This commit was created on github.com and signed with GitHub’s verified signature.
Copy link

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

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Mar 24, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.17% 55970 / 129638
🔵 Statements 43.17% 55970 / 129638
🔵 Functions 47.27% 2778 / 5876
🔵 Branches 79.73% 10457 / 13115
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/core/preview/observeFields.ts 77.71% 100% 63.63% 77.71% 103-104, 137-145, 157, 162, 171-174, 190-196, 209, 226, 260-267, 270-279
packages/sanity/src/core/util/draftUtils.ts 74.1% 97.36% 66.66% 74.1% 55-56, 134-137, 142-143, 160-172, 204-208, 212-216, 220-224
Generated in workflow #32762 for commit 441881c by the Vitest Coverage Report Action

Copy link
Contributor

github-actions bot commented Mar 24, 2025

⚡️ Editor Performance Report

Updated Mon, 24 Mar 2025 20:33:23 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 25.0 efps (40ms) 24.7 efps (41ms) +1ms (+1.3%)
article (body) 84.7 efps (12ms) 77.8 efps (13ms) +1ms (-/-%)
article (string inside object) 25.6 efps (39ms) 25.0 efps (40ms) +1ms (+2.6%)
article (string inside array) 21.7 efps (46ms) 21.3 efps (47ms) +1ms (+2.2%)
recipe (name) 30.3 efps (33ms) 45.5 efps (22ms) -11ms (-33.3%)
recipe (description) 33.3 efps (30ms) 52.6 efps (19ms) -11ms (-36.7%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (5ms) +0ms (-/-%)
synthetic (title) 17.5 efps (57ms) 15.7 efps (64ms) +7ms (+11.4%)
synthetic (string inside object) 15.9 efps (63ms) 15.7 efps (64ms) +1ms (+0.8%)

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 43ms 50ms 359ms 587ms 10.9s
article (body) 12ms 13ms 16ms 31ms 162ms 4.8s
article (string inside object) 39ms 41ms 45ms 55ms 37ms 6.6s
article (string inside array) 46ms 48ms 52ms 141ms 358ms 7.4s
recipe (name) 33ms 35ms 39ms 42ms 83ms 8.5s
recipe (description) 30ms 31ms 33ms 36ms 10ms 6.2s
recipe (instructions) 5ms 7ms 8ms 11ms 0ms 3.1s
synthetic (title) 57ms 59ms 68ms 226ms 1538ms 14.1s
synthetic (string inside object) 63ms 66ms 74ms 348ms 2014ms 9.6s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 41ms 47ms 72ms 368ms 633ms 10.9s
article (body) 13ms 14ms 16ms 39ms 57ms 4.7s
article (string inside object) 40ms 41ms 45ms 148ms 170ms 6.7s
article (string inside array) 47ms 50ms 57ms 150ms 212ms 7.4s
recipe (name) 22ms 23ms 25ms 44ms 0ms 7.2s
recipe (description) 19ms 20ms 21ms 23ms 0ms 4.7s
recipe (instructions) 5ms 7ms 8ms 9ms 0ms 3.1s
synthetic (title) 64ms 68ms 71ms 239ms 1865ms 13.9s
synthetic (string inside object) 64ms 69ms 73ms 254ms 1974ms 9.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.

Copy link
Contributor

github-actions bot commented Mar 24, 2025

📊 Playwright Test Report

Download Full E2E Report

This report contains test results, including videos of failing tests.

Copy link
Contributor

@pedrobonamin pedrobonamin left a comment

Choose a reason for hiding this comment

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

Thank you @bjoerge, tested all the cases I could think and this works great.

@bjoerge bjoerge merged commit e15f83a into next Mar 25, 2025
61 checks passed
@bjoerge bjoerge deleted the fix-use-version-info branch March 25, 2025 08:26
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.

None yet

2 participants