denoland/fresh

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

miguelrk opened this issue · 2 comments

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.

Ref #2657 with a reproduction guide.

Resolved by #2680