Skip to content

fix(app): allow static segments as siblings of dynamic route segments - #6953

Open
benedikt-bartscher wants to merge 1 commit into
reflex-dev:mainfrom
benedikt-bartscher:fix-static-dynamic-route-conflict
Open

fix(app): allow static segments as siblings of dynamic route segments#6953
benedikt-bartscher wants to merge 1 commit into
reflex-dev:mainfrom
benedikt-bartscher:fix-static-dynamic-route-conflict

Conversation

@benedikt-bartscher

@benedikt-bartscher benedikt-bartscher commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

_find_route_conflict flagged a conflict whenever an existing route's dynamic segment lined up with a different static segment of a new bracket-containing route (e.g. /posts/[id] vs /posts/all/[x]), and only in that registration order. React Router resolves such siblings fine (static wins), so only two dynamic segments with different names at the same position are a real conflict.

Review in cubic

_find_route_conflict flagged a conflict whenever an existing route's
dynamic segment lined up with a different static segment of a new
bracket-containing route (e.g. /posts/[id] vs /posts/all/[x]), and only
in that registration order. React Router resolves such siblings fine
(static wins), so only two dynamic segments with different names at the
same position are a real conflict.
@greptile-apps

greptile-apps Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR makes route-conflict detection symmetric and permits static route segments alongside dynamic segments while continuing to reject differently named dynamic segments in the same position.

  • Normalizes both routes before comparing segment types.
  • Stops conflict checking once a differing static segment separates the route trees.
  • Adds registration-order coverage for static and dynamic sibling routes.

Confidence Score: 5/5

The PR appears safe to merge, with the updated conflict detection matching the router’s static-over-dynamic specificity behavior.

The changed logic retains rejection of competing dynamic segment names while allowing route shapes that the router resolves deterministically, and the tests cover both registration orders.

Important Files Changed

Filename Overview
reflex/app.py Updates route-conflict comparison so only differently named dynamic segments at the same position conflict; the behavior aligns with route specificity rules.
tests/units/test_route.py Adds bidirectional coverage showing that static siblings of dynamic route segments are valid.

Reviews (1): Last reviewed commit: "fix(app): allow static segments as sibli..." | Re-trigger Greptile

@codspeed-hq

codspeed-hq Bot commented Aug 27, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 27 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing benedikt-bartscher:fix-static-dynamic-route-conflict (46aba35) with main (9f7f82c)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@benedikt-bartscher
benedikt-bartscher marked this pull request as ready for review August 27, 2026 08:09
@benedikt-bartscher
benedikt-bartscher requested a review from a team as a code owner August 27, 2026 08:09

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

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.

1 participant