-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
support document
containers in cleanup
#1330
base: main
Are you sure you want to change the base?
Conversation
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. Latest deployment of this branch, based on commit 6cb2087:
|
Please add a test. I don't understand why |
I don't know the setup, but is null when container is document. Locally, I fixed this by setting it to document.createElement('body'). I unfortunately do not have bandwidth to write a test for this, but the reproduction steps should be simple enough. I ran into this specifically when writing a test for a NextJS root layout, which attempts to mount an HTML and body element. The docs say to use container: document when rendering your own HTML element, which fixed the previous error during test but introduced the OP error during cleanup. |
@quisido thanks for taking the time to add this but we are not merging changes without proper coverage for them. |
Understandable. The PR is welcome to be updated. I opened an issue for it for tracking as well. I can try updating tests as time permits, but I wanted the problem and solution to both be documented. |
I tried writing a test for this but it passes in our tests because |
What:
When
container
is set todocument
, the cleanup step fails:This is because the code assumes
document.body
exists:In reality, both
container.parentNode
anddocument.body
arenull
.Why:
The tests erroneously fail.
How:
The attempt to remove the container from the body now only occurs when the body exists.
Checklist:
docs site N/A
resolves #1329