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(core): Global Document References support #8299

Open
wants to merge 42 commits into
base: next
Choose a base branch
from

Conversation

sgulseth
Copy link
Member

@sgulseth sgulseth commented Jan 16, 2025

Description

This is @skogsmaskin writing BTW 👋

This will add support for Global Document References (GDR) in the Studio. A Global Document Reference can reference something inside another project across the user's Sanity organization.

The implementation is very much alike cross-dataset-references, but there is a separate schema type that has it's unique config options:

export const globalDocumentReferenceType = defineType({
  type: 'globalDocumentReference',
  name: 'globalDocumentSubtype',
  title: 'Global document reference',
  resourceType: 'dataset',
  resourceId: 'exx11uqh.blog',
  to: [
    {
      type: 'book',
      icon: BookIcon,
      preview: {
        select: {
          title: 'title',
          media: 'coverImage',
        },
        prepare(val) {
          return {
            title: val.title,
            media: val.coverImage,
          }
        },
      },
    },
  ],
})

We don't want to release this yet to the public just yet, but it would be great if we could start reviewing it, so that it's ready to go when we need it. It also makes it possible to get some more test usage before we announce it.

What to review

  • That we are happy with the config options.
  • That the current implementation works well enough to be merged to next.

Testing

Open up the test studio in this branch, and select "playground (Staging)" workspace. Go to "Standard Inputs" and "Global document references test":

image

There is also added some automatic tests.

Note that the API currently only works in staging, and needs to be released first.

Notes for release

N/A - not to be announced yet.

Copy link

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

@juice49 juice49 force-pushed the next branch 2 times, most recently from 9caf5d8 to 691aad1 Compare January 23, 2025 13:56
@skogsmaskin skogsmaskin force-pushed the feat/dam-190/gdr branch 2 times, most recently from 9d4c639 to 2fbe79b Compare January 30, 2025 14:05
Copy link
Contributor

No changes to documentation

Copy link
Contributor

github-actions bot commented Jan 30, 2025

Component Testing Report Updated Feb 14, 2025 8:46 AM (UTC)

❌ Failed Tests (2) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 8s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 13s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ❌ Failed (Inspect) 1m 57s 4 0 2
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 53s 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 8s 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 45s 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 Jan 30, 2025

⚡️ Editor Performance Report

Updated Fri, 14 Feb 2025 08:45:08 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 26.0 efps (39ms) 24.1 efps (42ms) +3ms (+7.8%)
article (body) 72.5 efps (14ms) 72.2 efps (14ms) +0ms (-/-%)
article (string inside object) 27.8 efps (36ms) 27.0 efps (37ms) +1ms (+2.8%)
article (string inside array) 25.6 efps (39ms) 24.4 efps (41ms) +2ms (+5.1%)
recipe (name) 52.6 efps (19ms) 55.6 efps (18ms) -1ms (-5.3%)
recipe (description) 58.8 efps (17ms) 58.8 efps (17ms) +0ms (-/-%)
recipe (instructions) 99.9+ efps (5ms) 99.9+ efps (5ms) +0ms (-/-%)
synthetic (title) 20.4 efps (49ms) 20.6 efps (49ms) -1ms (-1.0%)
synthetic (string inside object) 20.0 efps (50ms) 20.8 efps (48ms) -2ms (-4.0%)

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) 39ms 44ms 46ms 429ms 347ms 10.8s
article (body) 14ms 16ms 72ms 262ms 427ms 5.8s
article (string inside object) 36ms 39ms 45ms 141ms 313ms 6.7s
article (string inside array) 39ms 42ms 50ms 138ms 241ms 6.7s
recipe (name) 19ms 21ms 24ms 43ms 0ms 7.9s
recipe (description) 17ms 18ms 23ms 56ms 0ms 4.6s
recipe (instructions) 5ms 6ms 7ms 9ms 0ms 3.0s
synthetic (title) 49ms 51ms 57ms 205ms 610ms 12.4s
synthetic (string inside object) 50ms 52ms 58ms 224ms 657ms 8.0s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 42ms 63ms 79ms 544ms 1037ms 11.4s
article (body) 14ms 17ms 21ms 147ms 346ms 5.5s
article (string inside object) 37ms 40ms 47ms 288ms 329ms 6.8s
article (string inside array) 41ms 43ms 47ms 301ms 372ms 7.0s
recipe (name) 18ms 20ms 21ms 24ms 0ms 7.2s
recipe (description) 17ms 18ms 20ms 40ms 0ms 4.1s
recipe (instructions) 5ms 7ms 8ms 14ms 0ms 3.1s
synthetic (title) 49ms 52ms 56ms 242ms 766ms 15.1s
synthetic (string inside object) 48ms 50ms 57ms 376ms 883ms 8.0s

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

rexxars and others added 11 commits February 11, 2025 17:38
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@skogsmaskin skogsmaskin marked this pull request as ready for review February 13, 2025 16:32
@skogsmaskin skogsmaskin requested a review from a team as a code owner February 13, 2025 16:32
@skogsmaskin skogsmaskin requested review from pedrobonamin and removed request for a team February 13, 2025 16:32
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.

10 participants