fix: middleware regressions (#3106)

Fixes some regressions found after merging
https://github.com/denoland/fresh/pull/3086

- Missing 404 middlewares when mounting sub-apps
- revert more staticFiles logic to always require the middleware like
before
This commit is contained in:
Marvin Hagemeister
2025-07-17 15:23:27 +02:00
committed by GitHub
parent c279efa345
commit 226e250386
7 changed files with 69 additions and 71 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
import { App } from "fresh";
import { App, staticFiles } from "fresh";
import {
allIslandApp,
assertNotSelector,
@@ -27,7 +27,8 @@ function testApp<T>(): App<T> {
const app = new App<T>()
.island(selfCounter, "SelfCounter", SelfCounter)
.island(partialInIsland, "PartialInIsland", PartialInIsland)
.island(jsonIsland, "JsonIsland", JsonIsland);
.island(jsonIsland, "JsonIsland", JsonIsland)
.use(staticFiles());
setBuildCache(app, getBuildCache(allIslandApp));
return app;
}
+2 -1
View File
@@ -1,4 +1,4 @@
import { App, fsRoutes } from "fresh";
import { App, fsRoutes, staticFiles } from "fresh";
import { Counter } from "./fixtures_islands/Counter.tsx";
import { IslandInIsland } from "./fixtures_islands/IslandInIsland.tsx";
import { JsonIsland } from "./fixtures_islands/JsonIsland.tsx";
@@ -37,6 +37,7 @@ await buildProd(allIslandApp);
function testApp(config?: FreshConfig) {
const app = new App(config);
setBuildCache(app, getBuildCache(allIslandApp));
app.use(staticFiles());
return app;
}
+3 -2
View File
@@ -1,4 +1,4 @@
import { App } from "fresh";
import { App, staticFiles } from "fresh";
import { Partial } from "fresh/runtime";
import {
allIslandApp,
@@ -40,7 +40,8 @@ function testApp<T>(): App<T> {
.island(selfCounter, "SelfCounter", SelfCounter)
.island(partialInIsland, "PartialInIsland", PartialInIsland)
.island(jsonIsland, "JsonIsland", JsonIsland)
.island(optOutPartialLink, "OptOutPartialLink", OptOutPartialLink);
.island(optOutPartialLink, "OptOutPartialLink", OptOutPartialLink)
.use(staticFiles());
setBuildCache(app, getBuildCache(allIslandApp));
return app;