#Typing params for top level routes that might have them?

7 messages · Page 1 of 1 (latest)

abstract pivot
#

Is it possible to type params that might exist at a higher level? Aim here is to swap cookie values if a specific param value changes

const appRoute = createRoute({
  getParentRoute: () => rootRoute,
  id: "app",
  component: () => <AuthenticationGuard component={App} />,
  beforeLoad: ({ context: { cookies }, location, params }) => {
    // params?.userId
},
});
lofty cedar
#

The route itself will only ever receive params if the route its on has params.

#

ie.

org.$orgId.tsx
org.$orgId.app.tsx <- has access to $orgId but not $userId
ord.$orgId.app.$userId.tsx
abstract pivot
#

Yup just logged params in this layout route and its receiving all params

#
app
 - users/$userID
 ... other users/ routes
 - /
lofty cedar
#

Either ways, it's not supported behaviors.
You should only be working with route content upto that point, not beyond it