Skip to content

Conversation

@cngonzalez
Copy link
Member

@cngonzalez cngonzalez commented Feb 5, 2026

Description

As we convert things to sources, we can also get rid of some complexity. There wasn't much sense in having separate preview and projection stores, at least without access to schemas. The projection store has batched querying and status coalescing and everything else we need in previews.

This PR removes the preview store and leaves some deprecated functions that pass through to the projection store to maintain backwards compatibility. The React hook uses useDocumentProjection directly, which means we can remove the deprecated functions in v3.

Some helpers were moved around and updated to prepare for this as well.

What to review

  • The new preview transformation logic in previewProjectionUtils.ts
  • The refactored useDocumentPreview hook implementation
  • The updated e2e tests that verify preview functionality
  • The kitchensink app changes that demonstrate the preview functionality

Testing

Added comprehensive unit tests for:

  • transformProjectionToPreview utility
  • getPreviewState function
  • resolvePreview function
  • useDocumentPreview hook

Also updated e2e tests in the kitchensink app to verify that preview results are displayed correctly and update in real-time when document content changes.

Fun gif

FIXES SDK-761

@vercel
Copy link

vercel bot commented Feb 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sdk-docs Ready Ready Preview, Comment Feb 6, 2026 4:48pm
sdk-kitchensink-react Ready Ready Preview, Comment Feb 6, 2026 4:48pm

Request Review

Copy link
Member Author

cngonzalez commented Feb 5, 2026

@github-actions
Copy link

github-actions bot commented Feb 5, 2026

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 95.37% (🎯 95%) 7803 / 8181
🟢 Statements 95.37% (🎯 95%) 7803 / 8181
🟢 Functions 95.94% (🎯 95%) 379 / 395
🟢 Branches 92.87% (🎯 90%) 2306 / 2483
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/core/src/preview/getPreviewState.ts 100% 83.33% 75% 100%
packages/core/src/preview/previewProjectionUtils.ts 100% 95.65% 100% 100%
packages/core/src/preview/resolvePreview.ts 100% 100% 100% 100%
packages/core/src/projection/types.ts 0% 0% 0% 0%
packages/react/src/hooks/preview/useDocumentPreview.tsx 92.59% 66.66% 100% 92.59% 113-114
Generated in workflow #2924 for commit d32d02a by the Vitest Coverage Report Action

@cngonzalez cngonzalez force-pushed the 02-05-feat_preview_update_preview_to_use_perspective_and_source branch from 6119f73 to 0b6ff40 Compare February 5, 2026 14:13
@cngonzalez cngonzalez force-pushed the 02-05-feat_preview_update_preview_to_use_perspective_and_source branch from 0b6ff40 to d13a510 Compare February 5, 2026 14:31
@cngonzalez cngonzalez force-pushed the 02-05-feat_preview_update_preview_to_use_perspective_and_source branch from d13a510 to 54d385d Compare February 5, 2026 14:41
@cngonzalez cngonzalez force-pushed the 02-03-feat_document_update_document_store_to_accept_sources branch from 14b1f0b to a1a8e01 Compare February 5, 2026 14:54
@cngonzalez cngonzalez force-pushed the 02-05-feat_preview_update_preview_to_use_perspective_and_source branch from 54d385d to cfb3ce5 Compare February 5, 2026 14:54
@cngonzalez cngonzalez force-pushed the 02-05-feat_preview_update_preview_to_use_perspective_and_source branch from cfb3ce5 to 9c747ff Compare February 5, 2026 14:59
@cngonzalez cngonzalez force-pushed the 02-03-feat_document_update_document_store_to_accept_sources branch from a1a8e01 to ef129f0 Compare February 5, 2026 14:59
@cngonzalez cngonzalez force-pushed the 02-05-feat_preview_update_preview_to_use_perspective_and_source branch from 9c747ff to 3d3f433 Compare February 5, 2026 14:59
@cngonzalez cngonzalez marked this pull request as ready for review February 5, 2026 15:24
@cngonzalez cngonzalez requested a review from a team as a code owner February 5, 2026 15:24
@cngonzalez cngonzalez requested review from laurenashpole and removed request for a team February 5, 2026 15:24
@cngonzalez cngonzalez force-pushed the 02-03-feat_document_update_document_store_to_accept_sources branch from ef129f0 to 07d8fea Compare February 5, 2026 15:42
@cngonzalez cngonzalez force-pushed the 02-05-feat_preview_update_preview_to_use_perspective_and_source branch from 3d3f433 to 004635a Compare February 5, 2026 15:43
@cngonzalez cngonzalez force-pushed the 02-05-feat_preview_update_preview_to_use_perspective_and_source branch from 004635a to f2dd8c8 Compare February 5, 2026 20:36
@cngonzalez cngonzalez force-pushed the 02-03-feat_document_update_document_store_to_accept_sources branch from 07d8fea to f687768 Compare February 5, 2026 20:36
@cngonzalez cngonzalez force-pushed the 02-03-feat_document_update_document_store_to_accept_sources branch 2 times, most recently from e80329b to 64c35c1 Compare February 6, 2026 16:47
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.

1 participant