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: migrate @sanity/presentation@corel codebase (#8312) #8317

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

stipsan
Copy link
Member

@stipsan stipsan commented Jan 17, 2025

Replays the changes in sanity-io/visual-editing#2081 on top of #8312.
Trying to make the diff here as small as possible so that we can iterate on presentation on next, and have less work syncing with corel

Copy link

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

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Jan 17, 2025

⚡️ Editor Performance Report

Updated Mon, 20 Jan 2025 10:04:41 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 24.4 efps (41ms) 24.1 efps (42ms) +1ms (+1.2%)
article (body) 62.9 efps (16ms) 63.3 efps (16ms) -0ms (-/-%)
article (string inside object) 25.0 efps (40ms) 27.8 efps (36ms) -4ms (-10.0%)
article (string inside array) 22.2 efps (45ms) 24.4 efps (41ms) -4ms (-8.9%)
recipe (name) 50.0 efps (20ms) 55.6 efps (18ms) -2ms (-10.0%)
recipe (description) 55.6 efps (18ms) 58.8 efps (17ms) -1ms (-5.6%)
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (6ms) +0ms (-/-%)
synthetic (title) 19.2 efps (52ms) 20.8 efps (48ms) -4ms (-7.7%)
synthetic (string inside object) 18.9 efps (53ms) 20.0 efps (50ms) -3ms (-5.7%)

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) 41ms 45ms 71ms 487ms 878ms 10.9s
article (body) 16ms 19ms 21ms 168ms 228ms 5.7s
article (string inside object) 40ms 44ms 49ms 114ms 164ms 7.0s
article (string inside array) 45ms 46ms 51ms 151ms 429ms 7.3s
recipe (name) 20ms 21ms 25ms 44ms 2ms 7.3s
recipe (description) 18ms 20ms 20ms 30ms 0ms 4.4s
recipe (instructions) 6ms 8ms 9ms 12ms 0ms 3.2s
synthetic (title) 52ms 54ms 60ms 272ms 704ms 12.9s
synthetic (string inside object) 53ms 57ms 65ms 379ms 1205ms 8.8s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 42ms 60ms 71ms 446ms 783ms 10.7s
article (body) 16ms 18ms 22ms 178ms 240ms 5.8s
article (string inside object) 36ms 39ms 43ms 63ms 143ms 6.6s
article (string inside array) 41ms 45ms 51ms 59ms 169ms 7.1s
recipe (name) 18ms 20ms 25ms 47ms 0ms 7.4s
recipe (description) 17ms 18ms 19ms 31ms 0ms 4.5s
recipe (instructions) 6ms 7ms 9ms 18ms 0ms 3.2s
synthetic (title) 48ms 50ms 58ms 209ms 421ms 12.5s
synthetic (string inside object) 50ms 51ms 55ms 139ms 703ms 7.8s

📚 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 Jan 17, 2025

Component Testing Report Updated Jan 20, 2025 10:04 AM (UTC)

❌ Failed Tests (5) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 7s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 12s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ❌ Failed (Inspect) 2m 39s 3 0 3
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 51s 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) 26s 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 ❌ Failed (Inspect) 2m 41s 20 0 1
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 ❌ Failed (Inspect) 2m 24s 20 0 1
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

@RitaDias RitaDias left a comment

Choose a reason for hiding this comment

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

Hi Cody! thank you for doing this, I have a few questions which are beneath!

Screen.Recording.2025-01-20.at.08.47.23.mov

Also, after testing out the presentation on the test studio I noticed that editing a version document seems to be broken (check the video), let me know if I can help in any way!!

dev/test-studio/preview/loader.tsx Show resolved Hide resolved
@@ -483,7 +483,11 @@ export function turboChargeResultIfSourceMap<T = unknown>(
}
return changedValue
},
perspective,
// TODO: Update applySourceDocuments to support releases.
Array.isArray(perspective) &&
Copy link
Contributor

Choose a reason for hiding this comment

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

huh interesting, why are we doing this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also jsut realised this code is the same changes as applied in the LoaderQueries.tsx should it be moved somewhere else so both can use it? Might be overengineering but since it looks to be the same code in somewhat seemingly related spaces

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 idea is for LiveQueries to replace LoaderQueries relatively soon. The rule of thumb we follow is that since only one of them will live on, we only make refactors that continue to make sense once LoaderQueries are deleted.
Does that make sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think so, just wonder if we should write that explicitly on the component so the question doesn't come up later if we need to make more changes to both components 🤔

packages/sanity/src/presentation/usePreviewUrl.ts Outdated Show resolved Hide resolved
@stipsan stipsan force-pushed the corel-migrate-presentation branch from 162a8cb to 110ebde Compare January 20, 2025 09:46
@RitaDias
Copy link
Contributor

Hi Cody! thank you for doing this, I have a few questions which are beneath!

Screen.Recording.2025-01-20.at.08.47.23.mov
Also, after testing out the presentation on the test studio I noticed that editing a version document seems to be broken (check the video), let me know if I can help in any way!!

An update to this: looks like it's something that already happens in COREL, created a linear story for it

Copy link
Contributor

@RitaDias RitaDias left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! 🚀

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.

3 participants