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

feat(cli): prepare nextjs starter template for live mode #7633

Merged
merged 5 commits into from
Oct 30, 2024

Conversation

SimeonGriggs
Copy link
Contributor

Description

Adds configuration file for live fetches when initializing a new Studio inside a Next.js application. Not used by the Studio, but designed for use in the Next.js application.

Do not release until the next version of next-sanity is available.

Notes for release

sanityFetch and SanityLive preconfigured for Studios initialized inside a Next.js application

Copy link

vercel bot commented Oct 18, 2024

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 Oct 29, 2024 0:15am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 0:15am
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 0:15am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 0:15am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 29, 2024 0:15am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Oct 29, 2024 0:15am

Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Oct 18, 2024

Component Testing Report Updated Oct 29, 2024 12:03 AM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 46s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 9s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 31s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 39s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 2m 33s 1 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 46s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 43s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 16s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 8s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 27s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 36s 12 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 Oct 18, 2024

⚡️ Editor Performance Report

Updated Tue, 29 Oct 2024 00:05:38 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 16.7 efps (60ms) 17.1 efps (59ms) -2ms (-2.5%)
article (body) 59.7 efps (17ms) 59.3 efps (17ms) +0ms (+0.6%)
article (string inside object) 18.2 efps (55ms) 17.2 efps (58ms) +3ms (+5.5%)
article (string inside array) 15.2 efps (66ms) 14.7 efps (68ms) +2ms (+3.0%)
recipe (name) 30.3 efps (33ms) 28.6 efps (35ms) +2ms (+6.1%)
recipe (description) 32.8 efps (31ms) 32.3 efps (31ms) +1ms (+1.6%)
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (6ms) +0ms (-/-%)
synthetic (title) 14.4 efps (70ms) 13.7 efps (73ms) +4ms (+5.0%)
synthetic (string inside object) 14.9 efps (67ms) 13.5 efps (74ms) +7ms (+10.4%)

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) 60ms 67ms 81ms 246ms 447ms 13.8s
article (body) 17ms 19ms 37ms 204ms 260ms 5.5s
article (string inside object) 55ms 58ms 66ms 239ms 415ms 9.0s
article (string inside array) 66ms 70ms 79ms 330ms 968ms 9.6s
recipe (name) 33ms 36ms 42ms 66ms 0ms 9.9s
recipe (description) 31ms 33ms 45ms 118ms 1ms 6.2s
recipe (instructions) 6ms 8ms 9ms 12ms 0ms 3.3s
synthetic (title) 70ms 73ms 84ms 355ms 1530ms 15.9s
synthetic (string inside object) 67ms 72ms 82ms 701ms 2098ms 10.7s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 59ms 64ms 101ms 295ms 568ms 13.6s
article (body) 17ms 20ms 35ms 254ms 338ms 5.9s
article (string inside object) 58ms 62ms 73ms 190ms 552ms 9.0s
article (string inside array) 68ms 70ms 77ms 117ms 943ms 9.3s
recipe (name) 35ms 38ms 43ms 80ms 11ms 10.3s
recipe (description) 31ms 34ms 37ms 68ms 0ms 6.1s
recipe (instructions) 6ms 8ms 9ms 13ms 0ms 3.2s
synthetic (title) 73ms 76ms 100ms 364ms 1912ms 21.1s
synthetic (string inside object) 74ms 78ms 108ms 396ms 1836ms 10.7s

📚 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.

@SimeonGriggs SimeonGriggs marked this pull request as ready for review October 28, 2024 00:35
@SimeonGriggs SimeonGriggs requested a review from a team as a code owner October 28, 2024 00:35
@SimeonGriggs SimeonGriggs requested review from ricokahler and removed request for a team October 28, 2024 00:35
rexxars
rexxars previously approved these changes Oct 28, 2024
Copy link
Member

@rexxars rexxars left a comment

Choose a reason for hiding this comment

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

Reading the next-sanity docs, it seems like the live content API might require vX to be used - are you okay leaving that up to the env file? Also, are we leaving the SanityLive component up to the user to implement "if they want it"?

…/index.ts


Add explanation to live.ts

Co-authored-by: Espen Hovlandsdal <[email protected]>
@SimeonGriggs
Copy link
Contributor Author

Reading the next-sanity docs, it seems like the live content API might require vX to be used - are you okay leaving that up to the env file? Also, are we leaving the SanityLive component up to the user to implement "if they want it"?

Good call. I've updated the live.ts file to set vX just on this client instance, with a description.

And yeah all these helper files are designed to be implemented by the user, they're not written into the Next.js app anywhere.

@rexxars rexxars changed the title feat: prepare nextjs starter template for live mode feat(cli): prepare nextjs starter template for live mode Oct 30, 2024
@rexxars rexxars added this pull request to the merge queue Oct 30, 2024
Merged via the queue into next with commit d018a71 Oct 30, 2024
68 checks passed
@rexxars rexxars deleted the feat/next-template-live-by-default branch October 30, 2024 15:37
bjoerge added a commit that referenced this pull request Nov 1, 2024
* next: (25 commits)
  fix(deps): update dependency @sanity/ui to ^2.8.16 (#7723)
  fix(deps): update dependency @sanity/ui to ^2.8.16 (#7722)
  chore(lockfile): update dependency @sanity/asset-utils to v2.0.7 (#7721)
  fix(deps): update dependency @sanity/ui to ^2.8.15 (#7717)
  fix(deps): update dependency @sanity/ui to ^2.8.15 (#7718)
  fix(deps): Update babel monorepo (#7719)
  chore(deps): update typescript-tooling (#7681)
  chore(deps): bump react-compiler linter (#7715)
  fix(deps): Update dev-non-major (#7708)
  fix(deps): update dependency react-rx to ^4.1.0 (#7714)
  fix(deps): update dependency @portabletext/editor to ^1.2.0 (#7709)
  chore(deps): update dependency lerna to ^8.1.9 (#7711)
  fix(deps): update dependency @sanity/ui to ^2.8.14 (#7713)
  chore: telemetry definition files are owned by @data-eng (#7703)
  fix(deps): update dependency react-rx to ^4.0.1 (#7712)
  fix(deps): Update dev-non-major (#7693)
  chore(deps): update dependency @vitejs/plugin-react to ^4.3.3 (#7688)
  fix(deps): update dependency @sanity/ui to ^2.8.13 (#7694)
  fix(deps): update dependency @portabletext/editor to ^1.1.11 (#7667)
  feat(cli): prepare nextjs starter template for live mode (#7633)
  ...
jordanl17 pushed a commit that referenced this pull request Nov 5, 2024
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