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(core): arrays of references support disableActions #8877

Merged
merged 8 commits into from
Mar 11, 2025

Conversation

jordanl17
Copy link
Member

Description

Before After
Screenshot 2025-03-11 at 04 20 26 Screenshot 2025-03-11 at 04 19 03

The same logic that is used across other arrays of items eg /packages/sanity/src/core/form/inputs/arrays/ArrayOfPrimitivesInput/ItemRow.tsx, has been added to the menu rendered in ReferenceItem, so that support for options.disableActions is brought to arrays of references.

There is a separate minor refactor that will be raised shortly which will consolidate all array item menus from a single hook that can be reused both here, in ItemRow and elsewhere that currently duplicates logic.

Note, the arrayCapabilities schema type has been updated and amended to expand its test usage

What to review

Testing

Manually verified

Notes for release

options.disableActions is supported on items in an array of references. More details on disableActions here

Copy link

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

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Mar 11, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42% 54408 / 129514
🔵 Statements 42% 54408 / 129514
🔵 Functions 46.88% 2728 / 5819
🔵 Branches 79.35% 10184 / 12834
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/core/form/inputs/ReferenceInput/ReferenceItem.tsx 9.11% 100% 0% 9.11% 55-71, 75-419
packages/sanity/src/structure/panes/document/statusBar/DocumentStatusBar.tsx 19.27% 100% 0% 19.27% 33-117
Generated in workflow #32007 for commit f15c246 by the Vitest Coverage Report Action

Copy link
Contributor

github-actions bot commented Mar 11, 2025

Component Testing Report Updated Mar 11, 2025 12:48 PM (UTC)

❌ Failed Tests (1) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 5s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ❌ Failed (Inspect) 1m 16s 5 0 1
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 47s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 24s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 13s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 27s 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 28s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 41s 21 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 13s 3 9 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 27s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 1m 34s 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 Mar 11, 2025

⚡️ Editor Performance Report

Updated Tue, 11 Mar 2025 14:32:28 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 22.5 efps (45ms) 20.0 efps (50ms) +6ms (+12.4%)
article (body) 73.0 efps (14ms) 82.0 efps (12ms) -1ms (-/-%)
article (string inside object) 25.0 efps (40ms) 22.7 efps (44ms) +4ms (+10.0%)
article (string inside array) 22.2 efps (45ms) 19.4 efps (52ms) +7ms (+14.4%)
recipe (name) 47.6 efps (21ms) 45.5 efps (22ms) +1ms (+4.8%)
recipe (description) 55.6 efps (18ms) 52.6 efps (19ms) +1ms (+5.6%)
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (6ms) -0ms (-/-%)
synthetic (title) 19.6 efps (51ms) 19.4 efps (52ms) +1ms (+1.0%)
synthetic (string inside object) 19.6 efps (51ms) 18.9 efps (53ms) +2ms (+3.9%)

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 74ms 89ms 366ms 770ms 12.3s
article (body) 14ms 15ms 20ms 145ms 191ms 5.2s
article (string inside object) 40ms 42ms 47ms 144ms 273ms 7.2s
article (string inside array) 45ms 47ms 50ms 60ms 134ms 7.0s
recipe (name) 21ms 22ms 26ms 38ms 0ms 7.6s
recipe (description) 18ms 19ms 20ms 28ms 0ms 4.6s
recipe (instructions) 6ms 7ms 8ms 19ms 0ms 3.1s
synthetic (title) 51ms 53ms 59ms 205ms 746ms 12.4s
synthetic (string inside object) 51ms 54ms 58ms 451ms 1084ms 8.4s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 50ms 63ms 92ms 366ms 1474ms 13.9s
article (body) 12ms 15ms 19ms 46ms 63ms 4.8s
article (string inside object) 44ms 47ms 51ms 141ms 203ms 7.6s
article (string inside array) 52ms 55ms 62ms 157ms 1101ms 8.8s
recipe (name) 22ms 24ms 27ms 45ms 0ms 7.4s
recipe (description) 19ms 21ms 25ms 62ms 16ms 4.9s
recipe (instructions) 6ms 7ms 8ms 34ms 0ms 3.2s
synthetic (title) 52ms 56ms 71ms 302ms 1229ms 13.3s
synthetic (string inside object) 53ms 55ms 70ms 255ms 925ms 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.

Verified

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

Verified

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

Verified

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

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
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.

Thanks, good catch!

@@ -63,6 +63,7 @@ const playwrightConfig = createPlaywrightConfig({
reporter: excludeGithub([['list'], ['blob']]),
use: {
...config.use,
video: 'retain-on-failure',
Copy link
Member

Choose a reason for hiding this comment

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

this seems unrelated, was it intentional?

@jordanl17 jordanl17 merged commit 03c2f60 into next Mar 11, 2025
66 checks passed
@jordanl17 jordanl17 deleted the fix/SAPP-2464-disableActions-refs branch March 11, 2025 15:28
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