Files
codegraph/docs
Colby Mchenry 654a853f5a fix(react-router): read the table a function returns when a variable hands it to the router (#2668)
Medusa's admin dashboard builds its router in a class's `render()`:
`const routes = getRouteMap({ settingsRoutes, coreRoutes })`, then
`createBrowserRouter(routes, { basename })`. `getRouteMap`, imported from
its own module, returns the literal table. The route-table pass
(`tableRoutes` in frameworks/react.ts) read a variable only when it held
the literal itself, so none of the 221 routes existed, and the dashboard's
`navigate()` calls and `<Link>`s led nowhere.

- `declaredTable` now reports a value initialized with a call
  (`getRouteMap({ … })`, `await loadRoutes()`) as the function to follow,
  and `tableNamed` / `exportedTable` follow it to the table it returns,
  local or imported. `export const routes = buildRoutes()` and
  `export default buildRoutes()` are read the same way.
- Of several declarations of a name in a file, the one in scope at the use
  is read (`visibleAt`). Scope comes from the graph's functions; a
  function-local declaration has no node of its own, so the declarations
  are read from the text. Another function's `const routes = getMenu()` is
  that function's own and is never followed. An exported name is a
  top-level one.
- What the function's parameters spread in (Medusa's `...coreRoutes`,
  filled from plugins) stays unread: no declaration in scope names it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:22:57 +00:00
..