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,12 +1,10 @@
|
|||||||
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}
|
||||||
@@ -15,7 +13,6 @@ export default function PropsDemo() {
|
|||||||
strArr={["foo"]}
|
strArr={["foo"]}
|
||||||
string="foo"
|
string="foo"
|
||||||
/>
|
/>
|
||||||
</Fader>
|
|
||||||
</Partial>
|
</Partial>
|
||||||
<p>
|
<p>
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ 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}
|
||||||
@@ -21,7 +20,6 @@ export default defineRoute((req, ctx) => {
|
|||||||
strArr={["foo", "bar"]}
|
strArr={["foo", "bar"]}
|
||||||
string="foobar"
|
string="foobar"
|
||||||
/>
|
/>
|
||||||
</Fader>
|
|
||||||
</Partial>
|
</Partial>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user