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

fix: puck context missing from preview render #357

Closed
wants to merge 1 commit into from

Conversation

4leite
Copy link
Contributor

@4leite 4leite commented Feb 28, 2024

No description provided.

Copy link

vercel bot commented Feb 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
puck-docs ✅ Ready (Inspect) Visit Preview Feb 28, 2024 6:49am

Copy link

vercel bot commented Feb 28, 2024

@4leite is attempting to deploy a commit to the Measured Team on Vercel.

A member of the Team first needs to authorize it.

export function Render<
UserConfig extends Config<any, any, any> = Config<any, any, any>
>({ config, data }: { config: UserConfig; data: Data }) {
export function Render<UserConfig extends Config = Config>({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These types are very deliberate, and I have found that removing the generics causes unexpected issues.

Fixed here as part of #257.

Copy link
Contributor Author

@4leite 4leite Mar 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is it widens the type (effectively returning any) which is probably what fixed your issue, but it means that the issue below snuck in because it wasn't strongly typed any more.

@@ -27,7 +37,7 @@ export const Preview = ({ id = "puck-preview" }: { id?: string }) => {
}}
style={{ zoom: disableZoom ? 1 : 0.75 }}
>
<Page dispatch={dispatch} state={state} {...rootProps}>
<Page {...rootProps}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dispatch and state were kept here to retain backwards compatibility with plugins from v0.12.0, before it was changed in v0.13.0.

I think I'd rather retain these for now, but we should probably mark them as // DEPRECATED so we remember to pull them out during a breaking change release.

@chrisvxd
Copy link
Member

@4leite I've reworked the types as part of #385, and also fixed the renderDropZone issue you've identified here. Closing this PR in favour of that.

@chrisvxd chrisvxd closed this Mar 26, 2024
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.

2 participants