fix(core): support method handler on _error, _404 and _500 routes#2955
Merged
marvinhagemeister merged 2 commits intomainfrom May 15, 2025
Merged
fix(core): support method handler on _error, _404 and _500 routes#2955marvinhagemeister merged 2 commits intomainfrom
marvinhagemeister merged 2 commits intomainfrom
Conversation
marvinhagemeister
pushed a commit
that referenced
this pull request
May 15, 2025
Related to #2953. I found it confusing that there were unsupported route configurations, that fails silently without any errors or wanings. Though I think it is a good idea to not throw for this, as that would be worse DX. But logging a warning if the developer is migrating from Fresh v1, or if the developer is using code that will not work (e.g. copy pasting a handler from a route to `_middleware`), I think it's helpful where reasonable to help guide a bit more. Does a small refactor first to hopefully improve typing to be more correct for `InternalRoute.handlers`, then adds warnings for the following: - `_middleware` using Object form (`GET`, `POST` handlers) of the handler format - Helps find issues when moving handler from route to middleware - `_layout` using `handlers` - E.g. if developer moves a route to a layout - ~~`_404`, `_500` or `_error` using Object handler form (`GET`, `POST` handlers), which is not yet supported (See #2953)~~ - No longer necessary as it is fixed by #2955
a69a896 to
12d7227
Compare
12d7227 to
0fdd402
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for using method handlers in
_error,_404and_500files.Fixes #2953