fix(dev-server): preserve serialized object component props
This commit is contained in:
1 parent
26af30cfe6
commit
a85cbf240d
4 files changed
+58
-3
No files matched your search
@@ -1746,7 +1746,15 @@ export function createHandlers(deps: RuntimeDeps): Handlers {
|
||||
// component defaults creates the real child boundary; the bridged prop
|
||||
// binding synchronizes the live value when the branch is instantiated.
|
||||
for (const [key, value] of Object.entries(props)) {
|
||||
if (/^\{[\s\S]*\}$/.test(value) && !/^\{t:/.test(value)) delete props[key];
|
||||
if (/^\{[\s\S]*\}$/.test(value) && !/^\{t:/.test(value)) {
|
||||
// SSR object props also start/end with braces. Preserve serialized
|
||||
// JSON; only unresolved expressions should fall back to defaults.
|
||||
try {
|
||||
JSON.parse(value);
|
||||
} catch {
|
||||
delete props[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (normalizedName === "languageswitcher" && deps.i18n) {
|
||||
props.locales ??= JSON.stringify(
|
||||
|
||||
Reference in new issue
Block a user