Skip to content

Add onReconnect & onRestart props to <SanityLive>#3511

Merged
stipsan merged 1 commit into
mainfrom
add-onReconnect-and-onRestart-props
May 11, 2026
Merged

Add onReconnect & onRestart props to <SanityLive>#3511
stipsan merged 1 commit into
mainfrom
add-onReconnect-and-onRestart-props

Conversation

@stipsan
Copy link
Copy Markdown
Member

@stipsan stipsan commented May 11, 2026

Split from #3109

Copilot AI review requested due to automatic review settings May 11, 2026 14:26
@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 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 11, 2026 2:36pm
next-sanity-static Ready Ready Preview, Comment May 11, 2026 2:36pm

Request Review

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 11, 2026

🦋 Changeset detected

Latest commit: 9d204c7

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 Minor

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

📚 TypeDoc Generation Result

TypeDoc generated successfully!

  • File size: 2.5M
  • Total exports: 265
  • Artifact: typedoc-5f4fc1996284a57753fd274ec3c1b4b98f1ec539
  • HTML docs preview: Download artifact

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

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

Adds configurable handlers for Sanity Live connection lifecycle events so apps can customize (or disable) the default router.refresh() behavior on reconnect/restart.

Changes:

  • Add onReconnect and onRestart props to the public <SanityLive /> props type (with new handler type definitions).
  • Wire onReconnect/onRestart through the React Server Component wrapper into the client component and invoke them on reconnect / restart events.
  • Re-export the new handler types from the default and next-js condition entrypoints and publish a minor changeset.

Reviewed changes

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

Show a summary per file
File Description
packages/next-sanity/src/live/shared/types.ts Introduces onReconnect/onRestart props and exports new handler types.
packages/next-sanity/src/live/conditions/react-server/index.ts Adjusts re-export list ordering (but currently doesn’t re-export new handler types).
packages/next-sanity/src/live/conditions/react-server/defineLive.tsx Passes onReconnect/onRestart through to the client component.
packages/next-sanity/src/live/conditions/next-js/index.ts Re-exports SanityLiveOnReconnect/SanityLiveOnRestart types.
packages/next-sanity/src/live/conditions/default/index.ts Re-exports SanityLiveOnReconnect/SanityLiveOnRestart types.
packages/next-sanity/src/live/client-components/SanityLive.tsx Implements reconnect/restart handler execution and default refresh behavior.
.changeset/clear-dingos-beg.md Declares a minor release for the new props.

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

Comment thread packages/next-sanity/src/live/client-components/SanityLive.tsx
Comment thread packages/next-sanity/src/live/client-components/SanityLive.tsx
Comment thread packages/next-sanity/src/live/conditions/react-server/index.ts
@stipsan stipsan force-pushed the add-onReconnect-and-onRestart-props branch from 3c69f1d to 9d204c7 Compare May 11, 2026 14:35
@stipsan stipsan merged commit e05f69d into main May 11, 2026
11 checks passed
@stipsan stipsan deleted the add-onReconnect-and-onRestart-props branch May 11, 2026 14:37
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