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): prevent unexpected release type picker mutation #8701

Merged
merged 5 commits into from
Feb 20, 2025

Conversation

juice49
Copy link
Contributor

@juice49 juice49 commented Feb 19, 2025

Description

In some scenarios, the release type picker produces a changed release object, despite the user making no intentional changes.

For example: when transitioning from an "at time" to an "ASAP" release, and then back again (without first closing the picker), the initial metadata.intendedPublishAt value is lost. This causes a mutation to occur when the user closes the release type picker when no mutation was expected. This is problematic because it produces an unexpected spinner in the UI, and could cause subtle unintended mutations.

This branch fixes several scenarios that provoked this bug.

What to review

The release type picker.

Testing

Added component tests for the known scenarios that provoke this bug.

Notes for release

Fixes a bug that caused the release type picker to unexpectedly enter a loading state.

Copy link

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

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Feb 19, 2025

⚡️ Editor Performance Report

Updated Wed, 19 Feb 2025 23:20:31 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 23.5 efps (43ms) 24.7 efps (41ms) -2ms (-4.7%)
article (body) 67.6 efps (15ms) 65.4 efps (15ms) +1ms (-/-%)
article (string inside object) 27.8 efps (36ms) 26.3 efps (38ms) +2ms (+5.6%)
article (string inside array) 24.4 efps (41ms) 22.2 efps (45ms) +4ms (+9.8%)
recipe (name) 50.0 efps (20ms) 50.0 efps (20ms) +0ms (-/-%)
recipe (description) 58.8 efps (17ms) 58.8 efps (17ms) +0ms (-/-%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (5ms) +0ms (-/-%)
synthetic (title) 19.6 efps (51ms) 20.8 efps (48ms) -3ms (-5.9%)
synthetic (string inside object) 19.2 efps (52ms) 20.4 efps (49ms) -3ms (-5.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) 43ms 56ms 66ms 310ms 767ms 10.7s
article (body) 15ms 17ms 22ms 264ms 497ms 6.2s
article (string inside object) 36ms 37ms 38ms 144ms 127ms 6.4s
article (string inside array) 41ms 43ms 45ms 149ms 140ms 6.8s
recipe (name) 20ms 21ms 26ms 52ms 0ms 7.9s
recipe (description) 17ms 18ms 21ms 35ms 0ms 4.5s
recipe (instructions) 5ms 7ms 8ms 11ms 0ms 3.0s
synthetic (title) 51ms 56ms 61ms 327ms 1092ms 12.9s
synthetic (string inside object) 52ms 60ms 73ms 258ms 1014ms 8.4s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 41ms 45ms 71ms 420ms 833ms 11.0s
article (body) 15ms 18ms 26ms 274ms 392ms 6.2s
article (string inside object) 38ms 41ms 43ms 134ms 134ms 6.9s
article (string inside array) 45ms 48ms 54ms 199ms 482ms 8.0s
recipe (name) 20ms 23ms 35ms 46ms 2ms 7.6s
recipe (description) 17ms 18ms 21ms 34ms 0ms 4.5s
recipe (instructions) 5ms 7ms 7ms 8ms 0ms 3.0s
synthetic (title) 48ms 51ms 59ms 210ms 589ms 12.7s
synthetic (string inside object) 49ms 51ms 54ms 622ms 914ms 8.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.

Copy link
Contributor

github-actions bot commented Feb 19, 2025

Component Testing Report Updated Feb 19, 2025 11:24 PM (UTC)

❌ Failed Tests (4) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 18s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 16s 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) 29s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 16s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 30s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 1m 16s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 52s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ❌ Failed (Inspect) 3m 1s 20 0 1
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 15s 3 9 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 31s 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

Copy link
Contributor

github-actions bot commented Feb 19, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.98% 54944 / 127828
🔵 Statements 42.98% 54944 / 127828
🔵 Functions 48.13% 2794 / 5805
🔵 Branches 79.48% 10641 / 13387
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/core/releases/__fixtures__/release.fixture.ts 100% 100% 100% 100%
packages/sanity/src/core/releases/tool/detail/ReleaseTypePicker.tsx 88.25% 94% 100% 88.25% 91-102, 116-119, 132-133, 164-173, 219, 261-263
Generated in workflow #30733 for commit 413290a by the Vitest Coverage Report Action

@juice49 juice49 force-pushed the fix/sapp-2107/unchanged-release-type-picker-should-noop branch from 882d439 to 8ba1942 Compare February 19, 2025 13:57
@juice49 juice49 changed the title Fix/sapp 2107/unchanged release type picker should noop fix(sanity): prevent release type picker request occurring when type unchanged Feb 19, 2025
@juice49 juice49 force-pushed the fix/sapp-2107/unchanged-release-type-picker-should-noop branch from e9c1df0 to 413290a Compare February 19, 2025 23:07
@juice49 juice49 changed the title fix(sanity): prevent release type picker request occurring when type unchanged fix(sanity): prevent unexpected release type picker mutation Feb 19, 2025
@juice49 juice49 marked this pull request as ready for review February 20, 2025 10:09
@juice49 juice49 requested a review from a team as a code owner February 20, 2025 10:09
@juice49 juice49 requested review from bjoerge and removed request for a team February 20, 2025 10:09
Copy link
Member

@bjoerge bjoerge left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for also including tests <3

@juice49 juice49 merged commit 2693a76 into next Feb 20, 2025
68 checks passed
@juice49 juice49 deleted the fix/sapp-2107/unchanged-release-type-picker-should-noop branch February 20, 2025 11:48
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