split out improvements from cache-components branch#3535
Conversation
🦋 Changeset detectedLatest commit: 9579916 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.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
cache-components branch
📚 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
Splits a focused set of improvements out of the cache-components branch (#3109) so they can land independently. The changes refine when defineLive calls draftMode()/uses tokens, fix resultSourceMap being unnecessarily requested on sync-tag fetches, allow enabling stega with serverToken, and add a substantial new test setup (MSW + Playwright browser tests with vitest projects).
Changes:
- Tighten
defineLivebehavior: only calldraftMode()when relevant tokens are set, allowstega: truewithserverToken, avoidresultSourceMapon the sync-tags request, and demote the missing-token warnings to development-only. - Skip
draftMode()in<SanityLive>when nobrowserTokenis configured. - Introduce vitest projects (
unit+browser), MSW handlers, a Playwright-based browser test suite forSanityLive, and a corresponding CIe2ejob.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/next-sanity/src/live/conditions/react-server/defineLive.tsx | Conditional draftMode()/token usage, unified token for both fetches, resultSourceMap: false on sync-tags, dev-only warnings, conditional includeDrafts default |
| packages/next-sanity/vitest.config.ts | Splits tests into unit (node) and browser (Playwright) vitest projects |
| packages/next-sanity/test/setupMocks.ts | MSW node handlers validating query expectations for sanityFetch tests |
| packages/next-sanity/test/SanityLive.test.tsx | Server-rendering tests for defineLive/SanityLive |
| packages/next-sanity/test/SanityLive.browser.test.tsx | Browser tests covering SSE/live event handling |
| packages/next-sanity/test/sanityFetch.test.tsx | Tests for sanityFetch perspective/stega/cacheMode behavior |
| packages/next-sanity/test/helpers.ts / helpers.browser.ts | Shared test helpers and MSW worker fixture |
| packages/next-sanity/test/mocks/browser.ts | MSW browser handlers for SSE mock tags |
| packages/next-sanity/test/mockServiceWorker.js | Generated MSW worker script |
| packages/next-sanity/package.json | Adds msw, playwright-based browser test deps, splits scripts into test (unit) / test:e2e |
| package.json | Adds root test:e2e script + playwright devDependency |
| pnpm-lock.yaml | Lockfile updates for new dependencies |
| apps/mvp/next.config.ts | Enables fetch logging |
| .oxlintrc.json | Enables switch-exhaustiveness-check |
| .github/workflows/ci.yml | Adds e2e job with Playwright browsers cache |
| .changeset/*.md | Changesets describing the behavioral fixes |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Split from #3109