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 15 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 19, 2025 3:22pm
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 3:22pm
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 19, 2025 3:22pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 3:22pm
test-next-studio ⬜️ Ignored (Inspect) Feb 19, 2025 3:22pm

@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 19, 2025 3:32 PM (UTC)

❌ Failed Tests (5) -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 1m 25s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 14s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ❌ Failed (Inspect) 2m 41s 3 0 3
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 1m 0s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 30s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 17s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 31s 6 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ❌ Failed (Inspect) 1m 57s 14 0 1
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 53s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ❌ Failed (Inspect) 2m 59s 20 0 1
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 15s 3 9 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 31s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 2m 1s 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 Wed, 19 Feb 2025 15:27:25 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 21.7 efps (46ms) 22.2 efps (45ms) -1ms (-2.2%)
article (body) 69.7 efps (14ms) 59.2 efps (17ms) +3ms (+17.8%)
article (string inside object) 25.6 efps (39ms) 25.0 efps (40ms) +1ms (+2.6%)
article (string inside array) 22.7 efps (44ms) 20.8 efps (48ms) +4ms (+9.1%)
recipe (name) 43.5 efps (23ms) 47.6 efps (21ms) -2ms (-8.7%)
recipe (description) 47.6 efps (21ms) 52.6 efps (19ms) -2ms (-9.5%)
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (6ms) +0ms (-/-%)
synthetic (title) 18.5 efps (54ms) 18.5 efps (54ms) +0ms (-/-%)
synthetic (string inside object) 20.4 efps (49ms) 19.6 efps (51ms) +2ms (+4.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) 46ms 69ms 83ms 519ms 1002ms 12.6s
article (body) 14ms 16ms 25ms 224ms 227ms 5.9s
article (string inside object) 39ms 42ms 46ms 140ms 128ms 6.6s
article (string inside array) 44ms 46ms 48ms 144ms 162ms 7.0s
recipe (name) 23ms 26ms 28ms 57ms 0ms 7.3s
recipe (description) 21ms 23ms 25ms 33ms 0ms 5.1s
recipe (instructions) 6ms 8ms 9ms 16ms 0ms 3.2s
synthetic (title) 54ms 57ms 76ms 286ms 1344ms 13.1s
synthetic (string inside object) 49ms 54ms 57ms 428ms 1084ms 8.5s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 45ms 52ms 88ms 463ms 1055ms 12.3s
article (body) 17ms 23ms 76ms 186ms 243ms 6.1s
article (string inside object) 40ms 44ms 47ms 63ms 137ms 6.9s
article (string inside array) 48ms 51ms 55ms 231ms 420ms 7.8s
recipe (name) 21ms 23ms 30ms 49ms 0ms 7.2s
recipe (description) 19ms 21ms 23ms 32ms 0ms 4.7s
recipe (instructions) 6ms 8ms 9ms 28ms 0ms 3.3s
synthetic (title) 54ms 58ms 85ms 300ms 1091ms 13.0s
synthetic (string inside object) 51ms 55ms 68ms 244ms 982ms 8.5s

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

@skogsmaskin skogsmaskin changed the title Feat/dam 190/gdr feat(core): Global Document References support Jan 30, 2025
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