From 8ec7544bd5ace3be37637ffd9c2963a0e3fd40c3 Mon Sep 17 00:00:00 2001 From: Greg Shear Date: Fri, 12 Jun 2026 15:09:20 -0400 Subject: [PATCH] Clean up admin/billing and collections splat routes - Collapse the admin/billing splat into a billing parent with an index route and a paymentMethod/new child, removing the duplicate billing registration and the dead /admin/billing/billing route. - As a result, /admin/billing/ now falls through to PageNotFound instead of rendering an empty content card (the splat no longer swallows it). - Wrap both billing routes in lazyElement for consistent error boundaries. - Drop the /* from the collections parent path; the existing * child handles the splat, matching react-router's v7_relativeSplatPath guidance. Behavior verified in-app: /admin/billing, /admin/billing/paymentMethod/new, /collections/create/new (dialog over table), and the new 404 for bad billing subpaths. --- src/context/Router/index.tsx | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/src/context/Router/index.tsx b/src/context/Router/index.tsx index d80c4a8db..2ed4611ca 100644 --- a/src/context/Router/index.tsx +++ b/src/context/Router/index.tsx @@ -230,7 +230,10 @@ const routes: RouteObject[] = [ }, { - path: `${authenticatedRoutes.collections.path}/*`, + // Splat handled by the `*` child below rather + // than a `path: 'collections/*'` parent, per + // react-router's v7_relativeSplatPath guidance. + path: authenticatedRoutes.collections.path, children: [ // Check details first as collections create // opens as dialog meaning we include the @@ -477,38 +480,27 @@ const routes: RouteObject[] = [ .path, element: suspended(), }, - // TODO (routing cleanup): the `billing/*` - // subtree below produces /admin/billing and - // /admin/billing/billing, and is duplicated - // by the standalone billing route that - // follows it. Preserved verbatim during the - // data-router migration; worth pruning. { - path: `${authenticatedRoutes.admin.billing.path}/*`, + path: authenticatedRoutes.admin.billing + .path, children: [ + { + index: true, + element: lazyElement( + + ), + }, { path: authenticatedRoutes.admin .billing.addPayment.path, - element: suspended( + element: lazyElement( ), }, - { - path: authenticatedRoutes.admin - .billing.path, - element: suspended( - - ), - }, ], }, - { - path: authenticatedRoutes.admin.billing - .path, - element: lazyElement(), - }, { path: authenticatedRoutes.admin.settings .path,