-
Notifications
You must be signed in to change notification settings - Fork 388
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: dynamically reconfigure codemirror instead of recreate on rerender #1125
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
@danieldelcore is attempting to deploy a commit to the CodeSandbox Team on Vercel. A member of the Team first needs to authorize it. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
f0b15e5
to
33f4ada
Compare
cc: @CompuIves / @danilowoz would really appreciate your 👁️ 👁️ on this one if you have some time 🙏 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense! Thank you
Legend! Thanks so much! |
It seems that something went wrong with the production build: https://sandpack.codesandbox.io/docs/quickstart I will investigate it soon |
Closes: #1124
This PR separates codemirror instantiation logic from subsequent prop updates.
Previously every time a decorator or other dependency is updated, it would trigger a complete recreation of the sandpack instance, resulting in strange behaviour such as the cursor would be repositioned or elements would flash.
To fix this, I've moved all extension configuration into a seperate hook, when rerun will recreate the entire config and dispatch a codemirror
reconfigure
message which safely updates the instance without any side effects.I have added a storybook example which illustrates the behaviour.