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

Add a root html element in Dioxus integration #120

Merged
merged 3 commits into from
Aug 16, 2024

Conversation

cfraz89
Copy link
Contributor

@cfraz89 cfraz89 commented Aug 15, 2024

Fixes #81 - Currently, dioxus apps without a single root element crash when rendered in blitz. This fixes that by creating a virtual <html> root element.

I experimented with a couple of other approaches as well, such as:

  • treating Document nodes as an element as well - a bit of an impedance mismatch since stylo makes a distinction between documents and elements
  • abolishing the concept of a root element and rendering all child elements of the root node - mismatch since taffy wants to draw a root element.

So this way seemed to be the best way to make it work out. With this fix you should find that the dioxus examples such as bare_style and tailwind no longer crash, and render correctly as far as they can.

@cfraz89 cfraz89 changed the title Add a root document element in Dioxus integratino Add a root document element in Dioxus integration Aug 15, 2024
@cfraz89 cfraz89 changed the title Add a root document element in Dioxus integration Add a root html element in Dioxus integration Aug 15, 2024
Copy link
Collaborator

@nicoburns nicoburns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll want to think this through properly at some point (I suspect we may want to align Blitz so that the same code can easily be used across Blitz and other other dioxus platforms, which may involve synthesising both <html> and <body>). But I reckon this is better than we have.

@nicoburns nicoburns merged commit ad61bf5 into DioxusLabs:main Aug 16, 2024
8 checks passed
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 this pull request may close these issues.

Blitz (dioxus runner) crashes if there is more than one root node
2 participants