Replace revalidateSyncTags prop with action on <SanityLive>#3536
Conversation
🦋 Changeset detectedLatest commit: fa5597e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📚 TypeDoc Generation Result✅ TypeDoc generated successfully!
The TypeDoc JSON file has been generated and validated. All documentation scripts completed successfully. |
There was a problem hiding this comment.
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, andrevalidateSyncTagsAction. - Updates
<SanityLive>client/server wiring and tests to useaction. - 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}}) |
| for (const tag of tags) { | ||
| revalidateTag(tag, 'max') | ||
| } |
Split from #3109