From 1c2b5f50b4d8673888fd8441dc9d674fe103d23d Mon Sep 17 00:00:00 2001 From: Jason McCallister Date: Wed, 25 Mar 2026 13:54:15 -0400 Subject: [PATCH] Updates the examples on the homepage (#3682) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The example island and partials are using the old import styles, this PR updates those examples. --------- Signed-off-by: Jason McCallister Co-authored-by: Bartek IwaƄczuk --- www/components/homepage/FormsSection.tsx | 14 ++++++-------- www/components/homepage/PartialsSection.tsx | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/www/components/homepage/FormsSection.tsx b/www/components/homepage/FormsSection.tsx index 8b2ca368..fa6305b3 100644 --- a/www/components/homepage/FormsSection.tsx +++ b/www/components/homepage/FormsSection.tsx @@ -8,23 +8,21 @@ import { ExampleArrow } from "../homepage/ExampleArrow.tsx"; import { FancyLink } from "../FancyLink.tsx"; import { FormSubmitDemo } from "../../islands/FormSubmitDemo.tsx"; -const routingCode = `import { Handlers } from "$fresh/server.ts"; +const routingCode = `import { define } from "../utils.ts"; -export const handler: Handlers = { - async POST(req) { - const form = await req.formData(); +export const handler = define.handlers({ + async POST(ctx) { + const form = await ctx.req.formData(); // Do something with the form data here, // then redirect user to thank you page - const headers = new Headers(); - headers.set("location", "/thanks"); return new Response(null, { status: 303, - headers, + headers: { location: "/thanks" }, }); }, -};`; +});`; export function FormsSection() { return ( diff --git a/www/components/homepage/PartialsSection.tsx b/www/components/homepage/PartialsSection.tsx index 9b40fe18..ab1db6fc 100644 --- a/www/components/homepage/PartialsSection.tsx +++ b/www/components/homepage/PartialsSection.tsx @@ -8,7 +8,7 @@ import { ExampleArrow } from "../../components/homepage/ExampleArrow.tsx"; import { RecipeDemo } from "../../components/homepage/RecipeDemo.tsx"; import { FancyLink } from "../../components/FancyLink.tsx"; -const islandCode = `import { Partial } from "$fresh/runtime.ts"; +const islandCode = `import { Partial } from "fresh/runtime"; export const Recipes = () => (