Add onReconnect & onRestart props to <SanityLive>#3511
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 9d204c7 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 |
📚 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
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
onReconnectandonRestartprops to the public<SanityLive />props type (with new handler type definitions). - Wire
onReconnect/onRestartthrough the React Server Component wrapper into the client component and invoke them onreconnect/restartevents. - Re-export the new handler types from the
defaultandnext-jscondition 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.
3c69f1d to
9d204c7
Compare
Split from #3109