fix: route groups (public)/(protected) should be pathless layouts

The file-based router was converting (group) segments to 'group?'
optional parameters, which broke all SPA routes (404 on every page).
Now (group) segments map to empty path '' which creates pathless
layout wrapper routes in react-router, matching Next.js behavior.

e.g. (public)/auth/login/page.tsx → route path '/auth/login'
     (protected)/dashboard/page.tsx → route path '/dashboard'

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
maulanasdqn
2026-04-11 15:58:36 +07:00
co-authored by Claude Opus 4.6
parent 6b3faf2a21
commit 86d9e759a6
@@ -303,9 +303,7 @@ export function getRouteSegmentsFromFilePath(
.map((segment) => {
if (segment.startsWith('.')) return '/';
if (segment.startsWith('('))
return (
getParamFromSegment(segment).replace('(', '').replace(')', '') + '?'
);
return '';
if (segment.startsWith('[')) return getParamFromSegment(segment);
return segment;
});