denoland / fresh

The next-gen web framework.
https://fresh.deno.dev
MIT License
12.56k stars 648 forks source link

[fresh@2.0] File-based routing has inconsisten middleware behavior #2588

Closed miguelrk closed 1 month ago

miguelrk commented 4 months ago

From this thread:

_middleware.ts files will not run the handler sometimes (I tried all handler signatures). It is pretty inconsistent, sometimes it runs (e.g. for /route/one, and then for /route/two it won't run. I might be doing something wrong (don't think so this time, I have the WIP docs revamped for Fresh 2.0 open), but I can confirm that at a minimum, the behavior is different than that of _middleware.ts files in fresh 1.x (not sure if intended or not). Funny enough, not doing file-based routing and using app.use((ctx) => {...}) directly instead, in e.g. main.ts with the same handler as in the _middleware.ts file, works normally as it should.

timreichen commented 1 month ago

Ref https://github.com/denoland/fresh/issues/2657 with a reproduction guide.

marvinhagemeister commented 1 month ago

Resolved by https://github.com/denoland/fresh/pull/2680