Skip to content

feat(live-preview): expose preview status helper [SPA-5289] - #170

Open
Maxim Cheremisin (maxcheremisin) wants to merge 1 commit into
feat/SPA-5161-live-preview-adaptersfrom
feat/SPA-5161-live-preview-status
Open

feat(live-preview): expose preview status helper [SPA-5289]#170
Maxim Cheremisin (maxcheremisin) wants to merge 1 commit into
feat/SPA-5161-live-preview-adaptersfrom
feat/SPA-5161-live-preview-status

Conversation

@maxcheremisin

@maxcheremisin Maxim Cheremisin (maxcheremisin) commented Sep 4, 2026

Copy link
Copy Markdown
Member

Summary

Adds a public status signal for the Preview Session transport and wires it into the React live-preview hook.

Description

The shared live-preview client exposes subscribeStatus. The exported sendPreviewStatus helper publishes this message to the containing preview host:

{
  source: 'experiences/live-preview',
  type: 'status',
  status: 'live' | 'static',
}
useLivePreview
  ├─ subscribeStatus(sendPreviewStatus)
  │   ├─ missing sessionId or previewToken → static
  │   └─ WebSocket opens → live
  └─ subscribe()
      └─ Preview Session update → refresh experience data

The React adapter connects the existing client lifecycle to the host-status helper. The generic package owns the message format, while the adapter only wires it into useLivePreview.

Relevant code:

  • packages/live-preview/src/live-preview-client.ts — status subscription and transport status
  • packages/live-preview/src/preview-status.ts — host-message helper
  • packages/adapter-react/src/use-live-preview.ts — React integration

Status updates are deduplicated, and reconnecting preserves the live-preview status.

This PR is stacked on #165 (feat/SPA-5161-live-preview-adapters).

Motivation and Context

The containing preview host needs to know whether the SDK is using static preview updates or an active Preview Session connection. A shared helper keeps this protocol consistent for direct package users and framework adapters.

Validation

  • npx nx test live-preview — 36 tests
  • npx vitest run src/use-live-preview.test.tsx — 7 tests

PR Checklist

  • I have read the CONTRIBUTING.md file
  • All commits follow conventional commits
  • Documentation is updated (if necessary)
  • PR doesn't contain any sensitive information
  • There are no breaking changes

Note: This PR was created with the contentful-github-create-pull-request skill, powered by Agents Kit. To follow or use this workflow, see the Agents Kit CLI skill docs.

@wiz-inc-38d59fb8d7

wiz-inc-38d59fb8d7 Bot commented Sep 4, 2026

Copy link
Copy Markdown

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
SAST Finding SAST Findings 1 Medium
Software Management Finding Software Management Findings -
Total 1 Medium

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try the Wiz Code extension for VS Code, JetBrains, or Visual Studio.

@maxcheremisin Maxim Cheremisin (maxcheremisin) changed the title feat(live-preview): expose preview status helper [SPA-5161] feat(live-preview): expose preview status helper [SPA-5289] Sep 8, 2026
@maxcheremisin
Maxim Cheremisin (maxcheremisin) marked this pull request as ready for review September 8, 2026 07:19
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