Skip to content

docs(router): document segment consumption during route evaluation #57437

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

Closed

Conversation

nesjett
Copy link
Contributor

@nesjett nesjett commented Aug 17, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove bot requested a review from AndrewKushnir August 17, 2024 21:05
@angular-robot angular-robot bot added area: docs Related to the documentation area: router labels Aug 17, 2024
@ngbot ngbot bot added this to the Backlog milestone Aug 17, 2024
@@ -1109,6 +1109,8 @@ export interface CanMatch {
* If all guards return `true`, navigation continues and the `Router` will use the `Route` during
* activation. If any guard returns `false`, the `Route` is skipped for matching and other `Route`
* configurations are processed instead.
*
* Segments array will only include parts not already consumed in previous parent route evaluations.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this true even when paramsInheritanceStrategy is set to 'always' ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently yes. It always works the same way.

Here is a setup with the default value for paramsInheritanceStrategy: https://codesandbox.io/p/devbox/infallible-sound-tmrpr7
Here, another setup with paramsInheritanceStrategy set to 'always': https://codesandbox.io/p/devbox/happy-bash-8f7wk8?workspaceId=f5c8f0ef-a755-4a46-b49a-4d65fbbe56a5

There, you can see that both setups (if nothing is wrong with how I provide the value to paramsInheritanceStrategy in the forRoot() config) produce the same result in the console (the guard logs an empty array for the segment)

Might that be a bug instead of missing documentation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is not a bug. Yes, this is working as it always has. I would suggest documenting this on the individual parameters rather than a long-form description. i.e.

@param route The `Route` being matched
@param segments The remaining segments not yet consumed...

@AndrewKushnir AndrewKushnir requested review from atscott and removed request for AndrewKushnir August 18, 2024 15:46
@AndrewKushnir AndrewKushnir added target: patch This PR is targeted for the next patch release action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 18, 2024
@JeanMeche
Copy link
Member

Without feedback for OP, I'll close this PR. Feel free to re-open it if you want to land the change. Thank you for your understanding.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: review The PR is still awaiting reviews from at least one requested reviewer area: docs Related to the documentation area: router target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants