Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(live-preview): strongly types message events #10148

Merged
merged 3 commits into from
Dec 23, 2024

Conversation

jacobsfletch
Copy link
Member

@jacobsfletch jacobsfletch commented Dec 23, 2024

Live Preview message events were typed with the generic MessageEvent interface without passing any of the Live Preview specific properties, leading to unknown types upon use. To fix this, there is a new LivePreviewMessageEvent which properly extends the underlying MessageEvent interface, providing much needed type safety to these functions. In the same vein, the UpdatedDocument type was not being properly shared across packages, leading to multiple independent definitions of this type. This type is now exported from payload itself and renamed to DocumentEvent for improved semantics. Same with the FieldSchemaJSON type. This PR also adjusts where globally scoped variables are set, putting them within the shared _payloadLivePreview namespace instead of setting them individually at the top-level.

@jacobsfletch jacobsfletch changed the title chore(live-preview): strongly types message events and adjusts global scope chore(live-preview): strongly types message events Dec 23, 2024
@jacobsfletch jacobsfletch enabled auto-merge (squash) December 23, 2024 17:44
@jacobsfletch jacobsfletch merged commit 466f109 into main Dec 23, 2024
72 checks passed
@jacobsfletch jacobsfletch deleted the chore/lp-message-events branch December 23, 2024 18:19
Copy link
Contributor

🚀 This is included in version v3.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant