diff --git a/deno.json b/deno.json index 7977979b2..236436979 100644 --- a/deno.json +++ b/deno.json @@ -9,7 +9,7 @@ "std/": "https://deno.land/std@0.204.0/", "partytown/": "https://deno.land/x/partytown@0.4.8/", "deco-sites/std/": "https://denopkg.com/deco-sites/std@1.26.7/", - "deco/": "https://cdn.jsdelivr.net/gh/deco-cx/deco@30aa5339af59f53d5452b29eebde196a1df66a16/" + "deco/": "https://cdn.jsdelivr.net/gh/deco-cx/deco@1.80.0/" }, "lock": false, "tasks": { diff --git a/htmx/sections/Deferred.tsx b/htmx/sections/Deferred.tsx index 0c3401765..9014fd6cb 100644 --- a/htmx/sections/Deferred.tsx +++ b/htmx/sections/Deferred.tsx @@ -1,8 +1,8 @@ import type { Section } from "deco/blocks/section.ts"; import { useSection } from "deco/hooks/useSection.ts"; import { asResolved, isDeferred } from "deco/mod.ts"; +import { renderSection, shouldForceRender } from "../../utils/deferred.tsx"; import { AppContext } from "../mod.ts"; -import { shouldForceRender } from "../../utils/deferred.ts"; /** * @titleBy type @@ -10,8 +10,7 @@ import { shouldForceRender } from "../../utils/deferred.ts"; */ interface Load { type: "load"; - - // TODO: @gimenes add delay + /** @hide true */ delay?: number; } @@ -35,18 +34,19 @@ interface Intersect { export interface Props { sections: Section[]; - fallback?: Section; + /** @hide true */ + fallbacks?: Section[]; trigger?: Load | Revealed | Intersect; loading?: "lazy" | "eager"; } const Deferred = (props: Props) => { - const { sections, loading, trigger, fallback } = props; + const { sections, loading, trigger } = props; if (loading === "eager") { return ( <> - {sections.map(({ Component, props }) => )} + {sections.map(renderSection)} ); } @@ -61,15 +61,16 @@ const Deferred = (props: Props) => { } return ( -
- {fallback && } -
+ <> +
+ {props.fallbacks?.map(renderSection)} + ); };