fix: Partial state deserialization on simple islands (#1873)
This commit is contained in:
@@ -698,8 +698,10 @@ export async function applyPartials(res: Response): Promise<void> {
|
|||||||
|
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
|
|
||||||
if (deserialize) {
|
if (stateDom) {
|
||||||
state = deserialize(stateDom!, signal) as SerializedState;
|
state = deserialize
|
||||||
|
? deserialize(stateDom, signal) as SerializedState
|
||||||
|
: JSON.parse(stateDom)?.v;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect all partials and build up the vnode tree
|
// Collect all partials and build up the vnode tree
|
||||||
|
|||||||
@@ -1,21 +1,18 @@
|
|||||||
import { Partial } from "$fresh/runtime.ts";
|
import { Partial } from "$fresh/runtime.ts";
|
||||||
import { Fader } from "../../islands/Fader.tsx";
|
|
||||||
import PropIsland from "../../islands/PropIsland.tsx";
|
import PropIsland from "../../islands/PropIsland.tsx";
|
||||||
|
|
||||||
export default function PropsDemo() {
|
export default function PropsDemo() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Partial name="slot-1">
|
<Partial name="slot-1">
|
||||||
<Fader>
|
<p class="status-initial">initial</p>
|
||||||
<p class="status-initial">initial</p>
|
<PropIsland
|
||||||
<PropIsland
|
boolean={true}
|
||||||
boolean={true}
|
number={1}
|
||||||
number={1}
|
obj={{ foo: 123 }}
|
||||||
obj={{ foo: 123 }}
|
strArr={["foo"]}
|
||||||
strArr={["foo"]}
|
string="foo"
|
||||||
string="foo"
|
/>
|
||||||
/>
|
|
||||||
</Fader>
|
|
||||||
</Partial>
|
</Partial>
|
||||||
<p>
|
<p>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -12,16 +12,14 @@ export const config: RouteConfig = {
|
|||||||
export default defineRoute((req, ctx) => {
|
export default defineRoute((req, ctx) => {
|
||||||
return (
|
return (
|
||||||
<Partial name="slot-1">
|
<Partial name="slot-1">
|
||||||
<Fader>
|
<p class="status-updated">updated</p>
|
||||||
<p class="status-updated">updated</p>
|
<PropIsland
|
||||||
<PropIsland
|
boolean={false}
|
||||||
boolean={false}
|
number={42}
|
||||||
number={42}
|
obj={{ foo: 123456 }}
|
||||||
obj={{ foo: 123456 }}
|
strArr={["foo", "bar"]}
|
||||||
strArr={["foo", "bar"]}
|
string="foobar"
|
||||||
string="foobar"
|
/>
|
||||||
/>
|
|
||||||
</Fader>
|
|
||||||
</Partial>
|
</Partial>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user