Skip to content

Replace revalidateSyncTags prop with action on <SanityLive>#3536

Merged
stipsan merged 6 commits into
mainfrom
replace-revalidateSyncTags-prop-with-action
May 15, 2026
Merged

Replace revalidateSyncTags prop with action on <SanityLive>#3536
stipsan merged 6 commits into
mainfrom
replace-revalidateSyncTags-prop-with-action

Conversation

@stipsan
Copy link
Copy Markdown
Member

@stipsan stipsan commented May 15, 2026

Split from #3109

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 15, 2026

🦋 Changeset detected

Latest commit: fa5597e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
next-sanity Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented May 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
next-sanity Ready Ready Preview, Comment May 15, 2026 4:44pm
next-sanity-static Ready Ready Preview, Comment May 15, 2026 4:44pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 15, 2026

📚 TypeDoc Generation Result

TypeDoc generated successfully!

  • File size: 2.5M
  • Total exports: 269
  • Artifact: typedoc-659ccfdab2a5ac841f37f61eb86e3486afef2297
  • HTML docs preview: Download artifact

The TypeDoc JSON file has been generated and validated. All documentation scripts completed successfully.

@stipsan stipsan merged commit 7c18db6 into main May 15, 2026
12 checks passed
@stipsan stipsan deleted the replace-revalidateSyncTags-prop-with-action branch May 15, 2026 16:46
@squiggler-app squiggler-app Bot mentioned this pull request May 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR replaces the <SanityLive> revalidateSyncTags prop with a more general action API, adds a parseTags helper for action implementations, and updates tests/demo app usage around the new live invalidation behavior.

Changes:

  • Introduces SanityLiveAction, parseTags, and revalidateSyncTagsAction.
  • Updates <SanityLive> client/server wiring and tests to use action.
  • Adds demo/debug handling for content source maps and a major changeset documenting the API change.

Reviewed changes

Copilot reviewed 21 out of 21 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/next-sanity/src/live/client-components/SanityLive.tsx Uses action to handle live message events.
packages/next-sanity/src/live/conditions/react-server/defineLive.tsx Supplies the default action and waitFor behavior.
packages/next-sanity/src/live/server-actions/index.ts Implements the default server action.
packages/next-sanity/src/live/shared/parseTags.ts Adds tag parsing/validation helper.
packages/next-sanity/src/live/shared/types.ts Replaces prop/type definitions with SanityLiveAction.
packages/next-sanity/src/live/conditions/react-server/index.ts Exports new helper/type.
packages/next-sanity/src/live/conditions/next-js/index.ts Exports new helper/type.
packages/next-sanity/src/live/conditions/default/index.ts Exports new helper/type.
packages/next-sanity/src/__tests__/exports.spec.ts Updates export snapshot.
packages/next-sanity/test/SanityLive.test.tsx Updates server-render tests for action.
packages/next-sanity/test/SanityLive.browser.test.tsx Updates browser live-event tests for action.
packages/next-sanity/test/sanityFetch.test.ts Reformats/keeps sanityFetch coverage.
packages/next-sanity/test/parseTags.test.ts Adds tests for parseTags.
apps/mvp/app/sanity.client.ts Adjusts stega config.
apps/mvp/app/(website)/PostsLayout.tsx Removes debug logging.
apps/mvp/app/(website)/ContentSourceMapDebug.tsx Adds source map debug component.
apps/mvp/app/(website)/page.tsx Renders source map debug data.
apps/mvp/app/(website)/only-visual-editing/page.tsx Renders source map debug data.
apps/mvp/app/(website)/only-production/page.tsx Renders source map debug data.
apps/mvp/app/(website)/no-resolve-perspective/page.tsx Renders source map debug data.
.changeset/free-rings-press.md Documents the breaking API replacement.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* action={async (event, context) => {
* 'use server'
*
* for (const tag of parseTags(event.tags, context)) {
throw new TypeError('tags must be an array', {cause: {unsafeTags}})
}
if (unsafeTags.length === 0) {
throw new TypeError('tags must be an non-empty array', {cause: {unsafeTags}})
Comment on lines +32 to 34
for (const tag of tags) {
revalidateTag(tag, 'max')
}
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