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);
|
||||
|
||||
if (deserialize) {
|
||||
state = deserialize(stateDom!, signal) as SerializedState;
|
||||
if (stateDom) {
|
||||
state = deserialize
|
||||
? deserialize(stateDom, signal) as SerializedState
|
||||
: JSON.parse(stateDom)?.v;
|
||||
}
|
||||
|
||||
// Collect all partials and build up the vnode tree
|
||||
|
||||
@@ -1,21 +1,18 @@
|
||||
import { Partial } from "$fresh/runtime.ts";
|
||||
import { Fader } from "../../islands/Fader.tsx";
|
||||
import PropIsland from "../../islands/PropIsland.tsx";
|
||||
|
||||
export default function PropsDemo() {
|
||||
return (
|
||||
<div>
|
||||
<Partial name="slot-1">
|
||||
<Fader>
|
||||
<p class="status-initial">initial</p>
|
||||
<PropIsland
|
||||
boolean={true}
|
||||
number={1}
|
||||
obj={{ foo: 123 }}
|
||||
strArr={["foo"]}
|
||||
string="foo"
|
||||
/>
|
||||
</Fader>
|
||||
<p class="status-initial">initial</p>
|
||||
<PropIsland
|
||||
boolean={true}
|
||||
number={1}
|
||||
obj={{ foo: 123 }}
|
||||
strArr={["foo"]}
|
||||
string="foo"
|
||||
/>
|
||||
</Partial>
|
||||
<p>
|
||||
<a
|
||||
|
||||
@@ -12,16 +12,14 @@ export const config: RouteConfig = {
|
||||
export default defineRoute((req, ctx) => {
|
||||
return (
|
||||
<Partial name="slot-1">
|
||||
<Fader>
|
||||
<p class="status-updated">updated</p>
|
||||
<PropIsland
|
||||
boolean={false}
|
||||
number={42}
|
||||
obj={{ foo: 123456 }}
|
||||
strArr={["foo", "bar"]}
|
||||
string="foobar"
|
||||
/>
|
||||
</Fader>
|
||||
<p class="status-updated">updated</p>
|
||||
<PropIsland
|
||||
boolean={false}
|
||||
number={42}
|
||||
obj={{ foo: 123456 }}
|
||||
strArr={["foo", "bar"]}
|
||||
string="foobar"
|
||||
/>
|
||||
</Partial>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user