From 86d9e759a697d753a1f71db07335f3c2bff4a8fe Mon Sep 17 00:00:00 2001 From: maulanasdqn Date: Sat, 11 Apr 2026 15:58:36 +0700 Subject: [PATCH] fix: route groups (public)/(protected) should be pathless layouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- libs/utils/src/react-router/file-based-routing.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libs/utils/src/react-router/file-based-routing.tsx b/libs/utils/src/react-router/file-based-routing.tsx index de9442a..23c7b50 100644 --- a/libs/utils/src/react-router/file-based-routing.tsx +++ b/libs/utils/src/react-router/file-based-routing.tsx @@ -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; });