You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have read the console error message carefully (if applicable).
Description
If react-live LivePreview is re-rendered, it will peform preview from the LiveProvidercode prop instead of the current state of the content.
I fixed this in something similar using theLiveEditoronChange prop, to keep state of the current code being edited, and passing that state to the LiveProvider instead of the original code.
You retranspile the code in this case, (which makes sense because transpilation uses transformCode), but you retranspile it from the initial code instead of the current editor code.
Maybe the editor code state should be hoisted to the Live provider, or you should read the editor state with useImperativeHandle?
I'll just memoize the callback in Docusaurus, it's more optimized anyway. But I thought you'd be interested to know about this issue: passing an inline or stable function should probably lead to the same result.
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
If react-live
LivePreview
is re-rendered, it will peform preview from theLiveProvider
code
prop instead of the current state of the content.I fixed this in something similar using the
LiveEditor
onChange
prop, to keep state of the current code being edited, and passing that state to theLiveProvider
instead of the original code.Reproducible demo
No response
Steps to reproduce
Expected behavior
The newly edited code is used for the preview
Actual behavior
The original code is used for the preview until a subsequent edit
Your environment
No response
Self-service
The text was updated successfully, but these errors were encountered: