Remove refreshOnMount prop from <SanityLive>#3493
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 1357f3c 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. |
| /** | ||
| * Automatic refresh of RSC when the component <SanityLive /> is mounted. | ||
| * Note that this is different from revalidation, which is based on tags and causes `sanityFetch` calls to be re-fetched. | ||
| * @defaultValue `true` |
There was a problem hiding this comment.
Wow, all this time the doc block has been wrong and specified it's true by default, when it's in fact false 🤦
There was a problem hiding this comment.
Pull request overview
Removes the underused refreshOnMount API from the live preview <SanityLive /> component and deletes the internal implementation that supported it, with a major changeset documenting the breaking change.
Changes:
- Remove
refreshOnMountfrom public/typed props and stop threading it throughdefineLive→<SanityLive />. - Delete the
RefreshOnMountclient component and its conditional render path. - Update related changesets (add a major changeset for the removal; minor edits to other release notes).
Reviewed changes
Copilot reviewed 8 out of 8 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 | Removes refreshOnMount from the shared live props type. |
| packages/next-sanity/src/live/conditions/react-server/defineLive.tsx | Stops destructuring/passing refreshOnMount into the client component. |
| packages/next-sanity/src/live/client-components/SanityLive.tsx | Drops the prop/default and removes the <RefreshOnMount /> render path; switches RefreshOnInterval to a static import. |
| packages/next-sanity/src/live/client-components/RefreshOnMount.tsx | Removes the now-unused implementation entirely. |
| packages/next-sanity/src/live/client-components/RefreshOnInterval.tsx | Adds 'use client' and changes to a named export (RefreshOnInterval). |
| .changeset/sixty-ties-pick.md | Frontmatter quoting tweak (release note formatting). |
| .changeset/plain-lines-throw.md | Adds a major changeset describing the breaking change and a migration snippet. |
| .changeset/hip-pandas-retire.md | Adjusts example import paths in release notes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Create a new `RefreshOnMount` component: | ||
|
|
||
| ```tsx | ||
| // app/RefreshOnMount.tsx |
| ```diff | ||
| // app/layout.tsx | ||
| import {SanityLive} from '#sanity/live' | ||
| +import {DebugStatus} from './RefreshOnMount' |
| - <SanityLive refreshOnMount /> | ||
| + <SanityLive /> | ||
| + <RefreshOnMount /> | ||
| </> |
It's an under-utilized feature, we've never used it internally and neither do our customers.