Skip to content

prevent head rendering inside body when components are placed inside head {} - #5699

Open
sumitpsm wants to merge 1 commit into
DioxusLabs:mainfrom
sumitpsm:prevent-stale-head-rendering
Open

prevent head rendering inside body when components are placed inside head {}#5699
sumitpsm wants to merge 1 commit into
DioxusLabs:mainfrom
sumitpsm:prevent-stale-head-rendering

Conversation

@sumitpsm

@sumitpsm sumitpsm commented Jul 23, 2026

Copy link
Copy Markdown

When a component uses head tag inside it, e.g.

fn App() -> Element {
    rsx! {
        head {
          Component1 {}
          Component2 {}
          Component3 {}
          Component4 {}
        }
    }
}

that many placeholders used to get rendered inside body with the head tags

<div id="main"><script><!-- some js script -->
</script><head data-node-hydration="0"><!--placeholder1--><!--placeholder2--><!--placeholder3--><!--placeholder4--></head><!-- stuff --></div>

this fix skips rendering of all stale head tags and placeholders
since all the document::* components they are already rendered inside render_head

after fix:

<div id="main"><script><!-- some js script -->
</script><!-- stuff --></div>

@sumitpsm
sumitpsm requested a review from a team as a code owner July 23, 2026 05:52
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.

1 participant