-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(2767): prevent calling onRoute while prefixing #2782
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could just skip https://github.com/fastify/fastify/pull/2782/files#diff-cf6996cafd1df0bc168a5c5f3a7470f11fc3aea9f908091d5dd6be2e7b30a2c3L200 if prefixing: true
?
Sorry the link doesn't seem to be taking me to a line I could relate your comment to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would recommend documenting this property here.
I also would like to add a note inside ignoreTrallingSlash documentation about this behavior under the hood.
Lines 200 to 207 in b8122e2
|
I see, so we don't call the onRoute hook twice in the first place. Makes sense. Updated the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Do you think this is semver-major or could we ship it in v3? |
This didn't cause any existing tests to change also the behavior isn't a documented or even expected one. So I'd not think of it as a semver-major. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I understand this correctly? This PR adjust the internal API of route registration to pass around a new internal options
object that does not mutate the user provided options
object. This new internal object gets decorated with additional metadata about what sort of actions are being performed around route registration.
@jsumners This PR does not change user provided options, neither we used to. Adding an extra metadata was my initial proposal before Matteo suggested we could skip triggering So right now, this PR only makes it skip calling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree to release it as semver-patch since the route object was the same 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Co-authored-by: James Sumners <james@sumners.email>
make the prefixing check explicit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Alternative fix for #2767
Approach explained in #2767 (comment)
Checklist
npm run test
andnpm run benchmark
and the Code of conduct