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:
1 parent
571c419e51
commit
5de5d07c24
3 files changed
+488
-73
No files matched your search
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user