sanity-io / visual-editing

https://visual-editing-studio.sanity.build
MIT License
37 stars 20 forks source link

feat: releases v0.5 #2081

Open pedrobonamin opened 2 weeks ago

pedrobonamin commented 2 weeks ago

Pre read

This branch builds on top of releases branch, which includes the necessary packages updates.

Next steps:

Changes:

With the introduction of releases the perspective is now a global studio concern and a new type of perspective has been introduced bundle.{releaseId}

Example of a published release selection

Screenshot 2024-10-31 at 13 58 23 Screenshot 2024-10-31 at 13 58 38

Video 🎥

Video explaining the details https://www.loom.com/share/3894e17c19b247548dccf3976f661a29?sid=59625a39-bdbf-400f-ad9c-d4243acf4018

The issue with the drafts is now fixed.

Perspective selector removed

Given we have this new perspective selector, the draft | published selector from Presentation tool was removed

<RevisionSwitcher/> removed

This is not needed anymore, structure now knows about perspectives and it infers them from the global state and the form reacts according to the perspective selected.

Loaders updated.

The loaders LiveQueries and LoaderQueries were updated to use the bundlePerspective param.

Perspective type updated to include bundle.${string}

The global perspective can be any of published | previewDrafts | bundle.${string} this has been reflected in the code by updating the types were needed, this could be centralized instead of manually adding it everywhere, but wanted to easily reflect the intention in code for the review. This is relevant at the moment we need to query the data. When receiving a bundle.${string} perspective it should not use the perspective option in client.fetch , instead, it should use the bundlePerspective option, which takes an array of perspectives.

How does bundlePerspective works: bundles perspective allows the client to fetch data in a similar way as previewDrafts, but instead of only stacking changes of published and drafts, it allows us to stack multiple perspectives inside. So given you have the following documents:

-  foo, drafts.foo, versions.summer.foo
-  bar, versions.winter.bar

This bundlePerspective array is exposed by the usePerspective hook from sanity which takes care of applying the perspectives in the correct order, the perspectives will apply on top of each other from right to left. So if the same document is in two perspectives, it will be returned only in the first one found.

vercel[bot] commented 2 weeks ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
live-visual-editing-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 2:46pm
visual-editing-next-with-i18n ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 2:46pm
visual-editing-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 2:46pm
7 Skipped Deployments | Name | Status | Preview | Comments | Updated (UTC) | | :--- | :----- | :------ | :------- | :------ | | **visual-editing-astro** | ⬜️ Ignored ([Inspect](https://vercel.com/sanity-sandbox/visual-editing-astro/8RieTd1m643qAFTyxi1YRj59f6Fz)) | [Visit Preview](https://visual-editing-astro-git-corel.sanity.dev) | | Nov 6, 2024 2:46pm | | **visual-editing-next** | ⬜️ Ignored ([Inspect](https://vercel.com/sanity-sandbox/visual-editing-next/4Uswf4PfSsvcL4xx3v2vgj6WTmTd)) | [Visit Preview](https://visual-editing-next-git-corel.sanity.dev) | | Nov 6, 2024 2:46pm | | **visual-editing-nuxt** | ⬜️ Ignored ([Inspect](https://vercel.com/sanity-sandbox/visual-editing-nuxt/6LXBufzaw29QYSExhpHdyYTht85K)) | [Visit Preview](https://visual-editing-nuxt-git-corel.sanity.dev) | | Nov 6, 2024 2:46pm | | **visual-editing-page-builder-demo** | ⬜️ Ignored ([Inspect](https://vercel.com/sanity-sandbox/visual-editing-page-builder-demo/7CQvKooJ1JRGmzaEc3EfkMd6kpZ1)) | [Visit Preview](https://visual-editing-page-builder-demo-git-corel.sanity.dev) | | Nov 6, 2024 2:46pm | | **visual-editing-remix** | ⬜️ Ignored ([Inspect](https://vercel.com/sanity-sandbox/visual-editing-remix/6vcBRstKKDYjo2p4DT5XrKRVzCN2)) | [Visit Preview](https://visual-editing-remix-git-corel.sanity.dev) | | Nov 6, 2024 2:46pm | | **visual-editing-studio** | ⬜️ Ignored ([Inspect](https://vercel.com/sanity-sandbox/visual-editing-studio/Fzf5NTzTAmxFwWdkPqtNF6iQVgRp)) | [Visit Preview](https://vercel.live/open-feedback/visual-editing-studio-git-corel.sanity.dev?via=pr-comment-visit-preview-link&passThrough=1) | 💬 [**Add feedback**](https://vercel.live/open-feedback/visual-editing-studio-git-corel.sanity.dev?via=pr-comment-feedback-link) | Nov 6, 2024 2:46pm | | **visual-editing-svelte** | ⬜️ Ignored ([Inspect](https://vercel.com/sanity-sandbox/visual-editing-svelte/GGXbvouvyGUMpcdgApLADk8USnC6)) | [Visit Preview](https://visual-editing-svelte-git-corel.sanity.dev) | | Nov 6, 2024 2:46pm |
socket-security[bot] commented 2 weeks ago

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@sanity/client@6.22.2-bundle-perspective-2 Transitive: environment, network +26 3.58 MB pedro-sanity
npm/@sanity/icons@3.5.0-corel.0 None 0 1.45 MB mariuslundgard
npm/@sanity/types@3.59.2-corel.333 None 0 404 kB pedro-sanity
npm/@sanity/ui@2.10.0-corel.0 Transitive: environment +52 14.5 MB mariuslundgard
npm/@sanity/util@3.59.2-corel.333 None +1 4.53 MB pedro-sanity
npm/@sanity/vision@3.59.2-corel.333 Transitive: environment +81 13.6 MB pedro-sanity
npm/groq@3.59.2-corel.333 None 0 11.8 kB pedro-sanity
npm/sanity@3.59.2-corel.333 Transitive: environment, eval, filesystem, network, shell, unsafe +2147 377 MB pedro-sanity

🚮 Removed packages: npm/@sanity/client@6.22.2, npm/@sanity/icons@3.4.0, npm/@sanity/ui@2.8.10, npm/@sanity/util@3.62.2, npm/@sanity/vision@3.62.2, npm/groq@3.62.2

View full report↗︎