Skip to content

fix(sdk): bridge preview selection into session state#1362

Open
kiyeonjeon21 wants to merge 1 commit into
heygen-com:mainfrom
kiyeonjeon21:kj/sdk-preview-selection-bridge
Open

fix(sdk): bridge preview selection into session state#1362
kiyeonjeon21 wants to merge 1 commit into
heygen-com:mainfrom
kiyeonjeon21:kj/sdk-preview-selection-bridge

Conversation

@kiyeonjeon21

Copy link
Copy Markdown
Contributor

Summary

  • Subscribe SDK sessions to PreviewAdapter selection events.
  • Mirror preview-selected ids into getSelection() / selection().
  • Emit selectionchange from the session and clean up the preview listener on dispose().

Why

PreviewAdapter.select() is documented as firing selectionchange on the session, and the SDK React embed example reads selection through comp.on("selectionchange") and comp.getSelection().

Before this change, openComposition(..., { preview }) stored the preview adapter but never subscribed to its selection events, so preview-driven selection was not reflected in the SDK session state.

Testing

  • bun run --cwd packages/sdk test
  • bun run --cwd packages/sdk typecheck
  • bunx oxfmt --check packages/sdk/src/session.ts packages/sdk/src/session.test.ts
  • bunx oxlint packages/sdk/src/session.ts packages/sdk/src/session.test.ts
  • git diff --check

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