render: support streamed framework hydration

Make attribute maps live, preserve parser script execution state, and expose
element scrolling used by React commit callbacks. Connect fallback web streams
so React Router and Remix hydration payloads flow through codec transforms.
This commit is contained in:
SGavrl committed 2026-07-23 10:59:51 +00:00
1 parent 571c419e51
commit 5de5d07c24
3 files changed
+488 -73

No files matched your search

+16
View File
@@ -679,6 +679,22 @@ impl Page {
None => return,
};
// HTML scripts have an "already started" flag. Mark every
// parser-discovered script before running page code so React/Next
// hydration can move or hoist those nodes without appendChild
// executing them a second time.
if let Some(js) = &mut self.js {
let ids = all_scripts
.iter()
.map(|script| script.nid.to_string())
.collect::<Vec<_>>()
.join(",");
let _ = js.execute_script(
"<parser-scripts>",
&format!("globalThis.__markParserScripts([{}]);", ids),
);
}
let mut regular = Vec::new();
let mut deferred = Vec::new();
let mut async_scripts = Vec::new();