Skip to content

feat: persist Presentation perspective via onPerspectiveChange - #1531

Closed
stipsan wants to merge 10 commits into
feat/visual-editing-standalone-v2from
feat/visual-editing-perspective
Closed

feat: persist Presentation perspective via onPerspectiveChange#1531
stipsan wants to merge 10 commits into
feat/visual-editing-standalone-v2from
feat/visual-editing-perspective

Conversation

@stipsan

@stipsan stipsan commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Set the perspective cookie from studioPreviewPerspective on preview enable, and delete it on disable, using the same cookie flags as useSanityPerspective.
  • Default onPerspectiveChange writes that cookie so the first SSR after preview enable matches Presentation. A user-supplied handler replaces the default (same as refresh).
  • Document onPerspectiveChange in the visual editing docs.

Stacked on #1530. After that merges, retarget this PR at main.

Test plan

  • CI: unit tests, types, lint
  • Enable preview from Presentation and confirm the perspective cookie is set before the first SSR
  • Change perspective in Presentation and confirm the cookie updates (default handler)
  • Providing visualEditing.onPerspectiveChange replaces the default cookie write
  • Disable preview clears the perspective cookie

Made with Cursor

Set the perspective cookie on preview enable and keep it in sync when
the Studio perspective changes, so the first SSR after enable is correct.

Co-authored-by: Cursor <cursoragent@cursor.com>
@pkg-pr-new

pkg-pr-new Bot commented Aug 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@nuxtjs/sanity@1531

commit: d4fcc13

@stipsan

stipsan commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator Author

Closing this stack. Perspective cookie persistence now lives privately in #1532 (same internal overlay callback as variants) — no public onPerspectiveChange hook.

@stipsan stipsan closed this Aug 17, 2026
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.

1 participant