fix: synchronize mounted component props
This commit is contained in:
@@ -1769,7 +1769,17 @@ export function createHandlers(deps: RuntimeDeps): Handlers {
|
||||
},
|
||||
)
|
||||
: renderComponent();
|
||||
result += await renderComponents(rendered, translate, language, depth + 1);
|
||||
// Prop bindings are authored by the parent mount but consumed by the
|
||||
// rendered child's scope. The mount itself is replaced during SSR, so
|
||||
// carry those reserved attributes onto the child's scope root.
|
||||
const propBindings = Array.from(
|
||||
attrStr!.matchAll(/\s(data-wrn-prop-bind-[A-Za-z0-9_-]+(?:="[^"]*")?)/g),
|
||||
(match) => ` ${match[1]}`,
|
||||
).join("");
|
||||
const bridged = propBindings
|
||||
? rendered.replace(/(<[A-Za-z][A-Za-z0-9-]*\b[^>]*\bdata-scope="[^"]*")/, `$1${propBindings}`)
|
||||
: rendered;
|
||||
result += await renderComponents(bridged, translate, language, depth + 1);
|
||||
} catch (err) {
|
||||
console.error(`[wrnexus] component '${name}' failed to render`, err);
|
||||
deps.devToolbar?.collector.add(
|
||||
|
||||
Reference in New Issue
Block a user