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

remix project canvasrootcontainer is null after code editing #6345

Closed
gbalint opened this issue Sep 9, 2024 · 0 comments · Fixed by #6344
Closed

remix project canvasrootcontainer is null after code editing #6345

gbalint opened this issue Sep 9, 2024 · 0 comments · Fixed by #6344
Assignees

Comments

@gbalint
Copy link
Contributor

gbalint commented Sep 9, 2024

No description provided.

@gbalint gbalint self-assigned this Sep 9, 2024
liady pushed a commit that referenced this issue Dec 13, 2024
**Problem:**
Followup to #6326
In a Remix project it can happen that in the dispatch flow we don't have
the results of the rendering in the dom yet. It can even happen, that
after a build error is fixed, we still don't have the canvas root
container in the dom.
That is a critical issue, because we attach the mutation/resize
observers to the canvas root container element, so when we don't have
that we can subscribe them, so the dom sample is not going to run when
the rendering is finished.

**Fix:**
I needed an element, which is an ancestor of the canvas root container
and
1 is always rendered
2 does not contain canvas controls or other content
I choose canvas-container-outer, but I needed to modify its ancestors so
it is always rendered, even when there is a build error.
To make sure we don't observe unnecessary elements, I filtered the query
for the resize observer to only include elements with the `data-uid`
attribute.

I needed to update the tests to make sure the observers from the
previous domwalkermutablestate don't continue to fire when there is a
change, because the outer canvas container can stay persistent between
test runs.

**Manual Tests:**
I hereby swear that:

- [x] I opened a hydrogen project and it loaded
- [x] I could navigate to various routes in Preview mode

Fixes #6345
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

Successfully merging a pull request may close this issue.

1 participant