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: releases v0.5 #2081

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

feat: releases v0.5 #2081

wants to merge 2 commits into from

Conversation

pedrobonamin
Copy link
Contributor

@pedrobonamin pedrobonamin commented Nov 4, 2024

Pre read

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

  • @sanity/client: 6.22.2-bundle-perspective
  • sanity: corel
  • @sanity/ui: local tar file (will be updated soon to a npm version)
  • @sanity/icons: local tar file (will be updated soon to a npm version)

Next steps:

  • Support for previews outside of the studio, think on adding the bundlePerspective data as a query param
  • update applySourceDocuments in the client to work with perspectives. Investigate what this does.
  • Test things and find bugs.
  • Creating a version document from presentation doesn't work as expected
  • List of documents shown in presentation is not 100% accurate, it shows only the version documents.

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
  • If you use bundlePerspective="summer", you will get the documents versions.summer.foo and bar
  • If you use bundlePerspective="winter,summer,drafts", you will get the documents versions.summer.fooand - -versions.winter.bar (This supports multiple perspectives in one query)
  • if you use bundlePerspective="drafts", you will get drafts.foo and 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.

@pedrobonamin pedrobonamin requested a review from a team as a code owner November 4, 2024 10:16
Copy link

vercel bot commented Nov 4, 2024

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 Dec 6, 2024 10:02am
visual-editing-next-with-i18n ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 6, 2024 10:02am
visual-editing-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 6, 2024 10:02am
7 Skipped Deployments
Name Status Preview Comments Updated (UTC)
visual-editing-astro ⬜️ Ignored (Inspect) Visit Preview Dec 6, 2024 10:02am
visual-editing-next ⬜️ Ignored (Inspect) Visit Preview Dec 6, 2024 10:02am
visual-editing-nuxt ⬜️ Ignored (Inspect) Visit Preview Dec 6, 2024 10:02am
visual-editing-page-builder-demo ⬜️ Ignored (Inspect) Visit Preview Dec 6, 2024 10:02am
visual-editing-remix ⬜️ Ignored (Inspect) Visit Preview Dec 6, 2024 10:02am
visual-editing-studio ⬜️ Ignored (Inspect) Visit Preview 💬 Add feedback Dec 6, 2024 10:02am
visual-editing-svelte ⬜️ Ignored (Inspect) Visit Preview Dec 6, 2024 10:02am

@pedrobonamin pedrobonamin mentioned this pull request Nov 4, 2024
4 tasks
@pedrobonamin pedrobonamin changed the base branch from releases to main November 4, 2024 10:58
@vercel vercel bot temporarily deployed to Preview – visual-editing-astro November 4, 2024 11:05 Inactive
Copy link

socket-security bot commented Nov 4, 2024

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

Package New capabilities Transitives Size Publisher
npm/@sanity/[email protected] None 0 408 kB bjoerge
npm/@sanity/[email protected] None +1 4.53 MB bjoerge
npm/@sanity/[email protected] Transitive: environment +81 11.2 MB bjoerge
npm/[email protected] None 0 11.8 kB bjoerge
npm/[email protected] Transitive: environment, eval, filesystem, network, shell, unsafe +2143 382 MB bjoerge

🚮 Removed packages: npm/@sanity/[email protected], npm/@sanity/[email protected], npm/[email protected]

View full report↗︎

chore(release): publish corel [skip ci]

fix: fully support perspectives

chore: improve typegen, add react compiler

chore: start moving to typegen

chore: fix weird build issue

chore: bump versions, tweak live setup

chore(release): publish corel [skip ci]

fix: ensure drafts are included in the documents list

chore: render array if array

chore(release): publish corel [skip ci]

fix: apply changes in latest corel tagged release

chore: use `@sanity/client` to validate API perspective

fix: only refetch if the list of ids have changed

chore: sync up remaining changes

fix: improve perspectives handling

chore: regen lockfile

chore: fix linter issues

chore(release): publish corel [skip ci]

chore: prepare release

fix: apply suggestion from pedro

fix: restore changes lost in merge conflict handling

fix: adjust to changes in bundle perspectives

chore: lockfile

fix: use publishedId from 'sanity'

fix: use publishedId when fetching union types

chore(release-overlay-previews): add simple release overlay previews (#2084)

* chore(release-overlay-previews): add simple release overlay previews

wip improve data fetching

wip ui

tidy up comments

tidy up postmessagereleases

ensure preview is only shown when data attribute is set

* chore(release-overlay-previews): use useReleases hook

* chore(release-overlay-previews): add releases.data to comlink useEffect deps

* fix: update how the nearestRelease is obtained

---------

fix: support bundle perspective (#2083)

* chore: fix live-next build

* fix: support bundle perspective

fix: ensure comlink stays connected if `navigate` changes (#2082)

* chore: find cause

* fix: handle comlink disconnect

* chore: remove debug code

fix: remove vite.config temp file

chore: revert presentation loader tag name change

chore(publish): publish new version

fix(loader): load drafts data when using previewDrafts

feat(presentation): add releases to presentation - first pass

chore(deps): update to 6.22.2-bundle-perspective client

chore(deps): update sanity to latest corel

chore(deps): remove local sanity icons and ui packages

chore(deps): update sanity corel to latest

chore(deps): update sanity corel to latest

chore(deps): update to 6.22.2-bundle-perspective client

fix(deps): add the registry files

fix: update types due to client change

chore(deps): link with tagged client release

Co-Authored-By: pedrobonamin <[email protected]>
Co-Authored-By: George Francis <[email protected]>
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