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

history.historyStore is undefined when using Puck in Remix #658

Open
lodybo opened this issue Oct 17, 2024 · 1 comment
Open

history.historyStore is undefined when using Puck in Remix #658

lodybo opened this issue Oct 17, 2024 · 1 comment

Comments

@lodybo
Copy link

lodybo commented Oct 17, 2024

I'm trying to write a plugin to use TinyMCE's rich text editor with Puck, heavily based on the puck-rich-text package (which uses Lexicon). I'm stuck at the implementation of the useSelected hook, which in puck-rich-text is being used to make sure the Rich Text Editor is actually selected before dispatching the onChange event.

I can add my editor and add content to it, but when I save my page (or rather, when the page is normally loaded), an error is thrown:

TypeError: Cannot read properties of undefined (reading 'hasPast')

It seems that history is undefined when returned from useAppContext().

I've created a reproduction here that you can run. The instructions are in the README.

@IMythx
Copy link
Contributor

IMythx commented Oct 17, 2024

as i remember this error happens when u call usePuck hook outside of <Puck/> since this component returns the context provider so you can't consume the context outside of it

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

No branches or pull requests

2 participants