From c349fb55c76528bc16d856c102008fe6340119ea Mon Sep 17 00:00:00 2001 From: fry69 <142489379+fry69@users.noreply.github.com> Date: Mon, 22 Sep 2025 06:04:16 +0200 Subject: [PATCH 1/3] docs: fix misleading main.tsx filenames --- docs/latest/advanced/app-wrapper.md | 2 +- docs/latest/advanced/error-handling.md | 8 +++++--- docs/latest/advanced/layouts.md | 6 +++--- docs/latest/concepts/app.md | 4 ++-- docs/latest/concepts/islands.md | 2 +- docs/latest/concepts/routing.md | 2 ++ docs/latest/concepts/static-files.md | 4 ++-- docs/latest/introduction/index.md | 2 +- 8 files changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/latest/advanced/app-wrapper.md b/docs/latest/advanced/app-wrapper.md index 54baa325b21..96e63563ecc 100644 --- a/docs/latest/advanced/app-wrapper.md +++ b/docs/latest/advanced/app-wrapper.md @@ -8,7 +8,7 @@ structure of the HTML document, typically up until the `
`-tag. It is only rendered on the server and never on the client. The passed `Component` value represents the children of this component. -```tsx main.tsx +```tsx routes/_app.tsx function AppWrapper({ Component }) { return ( diff --git a/docs/latest/advanced/error-handling.md b/docs/latest/advanced/error-handling.md index c9af64f62c0..c2c74a21683 100644 --- a/docs/latest/advanced/error-handling.md +++ b/docs/latest/advanced/error-handling.md @@ -21,6 +21,8 @@ Fresh supports two kind of error pages: To add an error page use [`app.onError()`](/docs/concepts/app#onerror). ```ts main.ts +import { App } from "fresh"; + const app = new App() .onError("*", (ctx) => { console.log(`Error: ${ctx.error}`); @@ -36,7 +38,7 @@ will be invoked. You can also nest error pages: -```ts main.ts +```ts const app = new App() // Top level error page .onError("*", (ctx) => { @@ -56,7 +58,7 @@ Not found errors are often treated differently than generic errors. You can both treat them with the `.onError()` way, but by adding a specific `.notFound()` handler, Fresh ensures that every 404 error will invoke this callback. -```ts main.ts +```ts const app = new App() // Top level error page .notFound((ctx) => { @@ -90,7 +92,7 @@ async function authMiddleware(ctx) { You can check the status code of the thrown `HttpError` in your error handler: -```ts main.ts +```ts app.onError((ctx) => { if (ctx.error instanceof HttpError) { const status = ctx.error.status; diff --git a/docs/latest/advanced/layouts.md b/docs/latest/advanced/layouts.md index 67e3050ebef..c0b0c347d38 100644 --- a/docs/latest/advanced/layouts.md +++ b/docs/latest/advanced/layouts.md @@ -8,7 +8,7 @@ HTML structure and only the content changes, a layout is a neat way to abstract this. Layouts only ever render on the server. The passed `Component` value represents the children of this component. -```tsx main.tsx +```tsx function PageLayout({ Component }) { return (
));
```
@@ -29,7 +29,7 @@ app.get("/user", (ctx) => ctx.render(
));
You can always opt out of this behaviour per tag, by adding the
`data-fresh-disable-lock` attribute.
-```tsx main.tsx
+```ts
// Opt-out of automatic caching headers
app.get(
"/user",
diff --git a/docs/latest/introduction/index.md b/docs/latest/introduction/index.md
index fd5f512bc05..c3eb7023f72 100644
--- a/docs/latest/introduction/index.md
+++ b/docs/latest/introduction/index.md
@@ -9,7 +9,7 @@ Fresh is a small, fast and extensible full stack web framework built on Web
Standards. It's designed for building high-quality, performant, and personalized
web applications.
-```tsx main.tsx
+```tsx main.ts
import { App } from "fresh";
const app = new App()
From a3dccf068c29faeda8b93c43c1cfd293f71f7c60 Mon Sep 17 00:00:00 2001
From: fry69 <142489379+fry69@users.noreply.github.com>
Date: Mon, 22 Sep 2025 06:09:55 +0200
Subject: [PATCH 2/3] docs: fix AppWrapper filename
---
docs/latest/advanced/app-wrapper.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/latest/advanced/app-wrapper.md b/docs/latest/advanced/app-wrapper.md
index 96e63563ecc..64c3d42263f 100644
--- a/docs/latest/advanced/app-wrapper.md
+++ b/docs/latest/advanced/app-wrapper.md
@@ -8,7 +8,7 @@ structure of the HTML document, typically up until the ``-tag. It is only
rendered on the server and never on the client. The passed `Component` value
represents the children of this component.
-```tsx routes/_app.tsx
+```tsx
function AppWrapper({ Component }) {
return (
From a22ec2530d2ed994d5a75f7b5e91501d300b7d45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?=