Skip to content

fix(dart_frog_cli): route mounting order#1931

Merged
felangel merged 13 commits intomainfrom
fix/route-mounting-order
Feb 28, 2026
Merged

fix(dart_frog_cli): route mounting order#1931
felangel merged 13 commits intomainfrom
fix/route-mounting-order

Conversation

@felangel
Copy link
Copy Markdown
Contributor

Status

READY

Description

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@felangel felangel self-assigned this Feb 23, 2026
@felangel felangel added the bug Something isn't working as expected label Feb 23, 2026
@felangel felangel force-pushed the fix/route-mounting-order branch from eca8834 to 0fc913f Compare February 23, 2026 05:47
setup: rm pubspec_overrides.yaml && dart pub global activate --source path ../../packages/dart_frog_cli
working_directory: examples/kitchen_sink

docker_custom:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is unnecessary and causing our e2e tests to always use the production version of the dart_frog_cli.

resolution: null
dependency_overrides: {}
'''),
resolution: null'''),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sorting order changes from upstream yaml package

$originalPubspecOverridesContent
$workspaceRootDartFrogOverride
equals('''
dependency_overrides:
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sorting order changes from upstream yaml package

@felangel felangel marked this pull request as ready for review February 27, 2026 23:52
@felangel felangel merged commit a8b60b2 into main Feb 28, 2026
28 checks passed
@felangel felangel deleted the fix/route-mounting-order branch February 28, 2026 17:56
@plumsky
Copy link
Copy Markdown

plumsky commented Mar 31, 2026

These fix may introducing a new bug.
In my project use dart_frog_cli 1.2.11 to build, the generated code create router like this:

Handler buildRootHandler() {
  final pipeline = const Pipeline();
  final router = Router()
    ..mount(
        '/happyfound/rosi', (context) => buildHappyfoundRosiHandler()(context))
    ..mount('/lesson/yw', (context) => buildLessonYwHandler()(context))
    ..mount('/mhy', (context) => buildMhyHandler()(context))
    ..mount('/ns/v1', (context) => buildNsV1Handler()(context))
    ..mount('/t/proxy', (context) => buildTProxyHandler()(context))
    ..mount('/', (context) => buildHandler()(context));
  return pipeline.addHandler(router);
}

After update dart_frog_cli to 1.2.14, the generated code create router like this:

Handler buildRootHandler() {
  final pipeline = const Pipeline();
  final router = Router()
    ..mount('/', (context) => buildHandler()(context))
    ..mount('/t/proxy', (context) => buildTProxyHandler()(context))
    ..mount('/ns/v1', (context) => buildNsV1Handler()(context))
    ..mount('/mhy', (context) => buildMhyHandler()(context))
    ..mount('/lesson/yw', (context) => buildLessonYwHandler()(context))
    ..mount('/happyfound/rosi', (context) => buildHappyfoundRosiHandler()(context));
  return pipeline.addHandler(router);
}

the /mhy can't reached anymore. I make a custom 404 page is in the root directory, so 404 for all after /.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Incorrect route mounting order

4 participants