Skip to content

fix(core): Make flattenRoutePath return a valid module #15333

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gentunian
Copy link

@gentunian gentunian commented Jun 29, 2025

flattenRoutePath method was returning an object instead of a module when path property was an empty string

closes #15332

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
  • Other... Please describe:

What is the current behavior?

Issue Number: #15332

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@coveralls
Copy link

coveralls commented Jun 29, 2025

Pull Request Test Coverage Report for Build c0ed7f7f-16b3-411f-a1ed-493630fb1838

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.918%

Totals Coverage Status
Change from base Build 8d643332-4d70-4223-ba18-9d20e00bb159: 0.0%
Covered Lines: 7197
Relevant Lines: 8094

💛 - Coveralls

path: 'child3',
children: [
{
path: '',
Copy link
Member

Choose a reason for hiding this comment

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

could you also add the case where path: '/'

Copy link
Author

Choose a reason for hiding this comment

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

sure thing. To better understand your suggestion, are you asking for the root parent of a route or for any child inside it?

Just in case, this PR only tries to fix the case where the path is an empty string the module property would be set to be the object being passed as a route configuration. That derives to the actual module not having the MODULE_PATH metadata set due to the fact that the metadata is set to a plain object instead.

Copy link
Member

Choose a reason for hiding this comment

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

root can be anything but the child will have the path: '/' just for completeness sake

Copy link
Author

Choose a reason for hiding this comment

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

I've just added it. Let me know if that feels good to you. Thanks.

flattenRoutePath method was returning an object instead of a module when path property was an empty string

closes nestjs#15332
@gentunian
Copy link
Author

build-and-test is failing codechecks and based on the error logs it looks like it's due to maintenance:

StatusCodeError: 503 - "<!DOCTYPE html>\n<html>\n  <head>\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n    <meta charset=\"utf-8\">\n    <title>Offline for Maintenance</title>\n    <style media=\"screen\">\n      html,body,iframe {\n        margin: 0;\n        padding: 0;\n      }\n\n      html,body {\n        height: 100%;\n        overflow: hidden;\n      }\n\n      iframe {\n        width: 100%;\n        height: 100%;\n        border: 0;\n      }\n    </style>\n  </head>\n  <body>\n    <iframe src=\"https://www.herokucdn.com/error-pages/maintenance-mode.html\"></iframe>\n  </body>\n</html>"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RouterModule wrongly setting module metadata when child.path is empty string
3 participants