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): use raw as default perspective #8586

Merged
merged 4 commits into from
Feb 11, 2025
Merged

fix(sanity): use raw as default perspective #8586

merged 4 commits into from
Feb 11, 2025

Conversation

bjoerge
Copy link
Member

@bjoerge bjoerge commented Feb 11, 2025

(meta: wrong ticket id, should've been sapp-2049)

Description

This explicitly uses raw as perspective unless overridden (e.g. by perspective stack)

This change should be safe, given that raw is currently the default on existing API versions.

What to review

Does the change make sense? As of this PR, Studio should longer do /query requests without a perspective param.

Testing

Everything should work as before

Notes for release

n/a - not user facing

Copy link

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

@@ -54,7 +54,7 @@ function listen(id: string, fields: string[], store: DocumentStore) {
}
const params = {id, draftId: getDraftId(id)}
return store.listenQuery(query, params, {
perspective: 'previewDrafts',
perspective: 'drafts',
Copy link
Member Author

Choose a reason for hiding this comment

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

not strictly related, but took the liberty of renaming this when I came across it.

)
return source.getClient({apiVersion: '2021-06-07'})
return source.getClient({apiVersion: 'v2025-02-07'})
Copy link
Member Author

Choose a reason for hiding this comment

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

We soon want to bump the version used by all internal code, so I think this change is sensible, esp. considering we've had the above warning throughout the lifetime of v3

Copy link
Contributor

Choose a reason for hiding this comment

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

This makes sense to me, I wonder if we would want to use here the DEFAULT_STUDIO_CLIENT_OPTIONS instead of this

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, will make a separate PR for it – would prefer a change like that to be subjected to a bit more testing :)

Copy link
Contributor

No changes to documentation

@@ -161,6 +161,7 @@ export function _createAuthStore({
useCdn: false,
...(token && {token}),
withCredentials: true,
perspective: 'raw',
Copy link
Member Author

Choose a reason for hiding this comment

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

the client created here is the basis of the client used throughout the Studio, and its config is inherited by client instances returned by useClient() etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

💡

Copy link
Contributor

github-actions bot commented Feb 11, 2025

⚡️ Editor Performance Report

Updated Tue, 11 Feb 2025 10:06:16 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 22.7 efps (44ms) 24.1 efps (42ms) -3ms (-5.7%)
article (body) 63.3 efps (16ms) 63.3 efps (16ms) +0ms (-/-%)
article (string inside object) 23.8 efps (42ms) 25.6 efps (39ms) -3ms (-7.1%)
article (string inside array) 22.0 efps (46ms) 22.2 efps (45ms) -1ms (-1.1%)
recipe (name) 50.0 efps (20ms) 50.0 efps (20ms) +0ms (-/-%)
recipe (description) 55.6 efps (18ms) 55.6 efps (18ms) +0ms (-/-%)
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (6ms) +0ms (-/-%)
synthetic (title) 20.4 efps (49ms) 20.4 efps (49ms) +0ms (-/-%)
synthetic (string inside object) 20.8 efps (48ms) 20.4 efps (49ms) +1ms (+2.1%)

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) 44ms 48ms 68ms 379ms 984ms 12.9s
article (body) 16ms 18ms 47ms 277ms 477ms 6.6s
article (string inside object) 42ms 46ms 49ms 149ms 370ms 7.4s
article (string inside array) 46ms 52ms 59ms 241ms 335ms 7.9s
recipe (name) 20ms 21ms 23ms 41ms 0ms 7.2s
recipe (description) 18ms 19ms 21ms 37ms 0ms 4.5s
recipe (instructions) 6ms 8ms 9ms 10ms 0ms 3.2s
synthetic (title) 49ms 52ms 62ms 229ms 605ms 12.4s
synthetic (string inside object) 48ms 50ms 60ms 403ms 800ms 8.2s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 42ms 62ms 73ms 375ms 737ms 10.6s
article (body) 16ms 18ms 24ms 202ms 262ms 5.9s
article (string inside object) 39ms 41ms 50ms 217ms 306ms 7.3s
article (string inside array) 45ms 48ms 55ms 247ms 432ms 7.7s
recipe (name) 20ms 22ms 34ms 50ms 0ms 7.3s
recipe (description) 18ms 19ms 21ms 46ms 0ms 4.6s
recipe (instructions) 6ms 8ms 9ms 25ms 0ms 3.1s
synthetic (title) 49ms 53ms 77ms 328ms 784ms 13.0s
synthetic (string inside object) 49ms 51ms 58ms 513ms 982ms 8.1s

📚 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 11, 2025

Component Testing Report Updated Feb 11, 2025 10:31 AM (UTC)

❌ Failed Tests (3) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 12s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 13s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ❌ Failed (Inspect) 2m 35s 3 0 3
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 54s 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) 15s 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 35s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 2m 4s 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

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 42.43% 53739 / 126641
🔵 Statements 42.43% 53739 / 126641
🔵 Functions 47.93% 2769 / 5777
🔵 Branches 78.76% 10287 / 13061
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/sanity/src/core/hooks/useClient.ts 60% 66.66% 100% 60% 28-31
packages/sanity/src/core/store/_legacy/authStore/createAuthStore.ts 53.69% 54.16% 41.66% 53.69% 37-41, 43-44, 49-54, 57-65, 84-112, 146, 150-151, 185, 191-226, 229-238, 241-255
packages/sanity/src/presentation/useDocumentLocations.ts 0% 0% 0% 0% 1-179
packages/sanity/src/structure/panes/documentList/DocumentListPane.tsx 90.38% 44.44% 100% 90.38% 100, 142-145, 153-154, 166-167, 169-170, 177-178, 180-181
Generated in workflow #30136 for commit d98b230 by the Vitest Coverage Report Action

@bjoerge bjoerge added this pull request to the merge queue Feb 11, 2025
Merged via the queue into next with commit 4371559 Feb 11, 2025
64 checks passed
@bjoerge bjoerge deleted the sapp-2047 branch February 11, 2025 15: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.

2 participants