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

Sandboxed children of trusted Components are not re-rendered when the parent updates #356

Open
andy-haynes opened this issue Mar 7, 2024 · 0 comments
Assignees
Labels
bug Something isn't working P0 - Release requirement

Comments

@andy-haynes
Copy link
Contributor

When a trusted Component renders a sandboxed child, there are React DOM roots for both the trusted parent and sandboxed child. Since the parent must render the outer element of the sandboxed Component, when the parent re-renders it replaces the sandboxed Component's container element. Even if the sandboxed child re-renders, the DOM root associated with the sandboxed child is no longer mounted on the page.

One workaround is to detect whether the DOM root is still mounted and re-mount if necessary, but this may be good cause to challenge the current implementation's use of React DOM roots. Another approach would be to serialize the React element (probably via SSR methods), using DOM manipulation to stitch existing sandboxed child nodes into the re-rendered parent DOM. I think this is a very promising approach that reduces performance overhead and opens up the use of validation via dompurify.

@andy-haynes andy-haynes added the bug Something isn't working label Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P0 - Release requirement
Projects
Status: Todo
Development

No branches or pull requests

2 participants