-
-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Closed
Description
It looks like the array of currently active routes is no longer passed down to route components. This makes things a bit tricky for the Relay integration, because I was previously using branch
(now routes
on RoutingContext
) for two reasons:
- Our API is just to replace
createElement
and to add extra prop(erties) to routes. However, to build the aggregated query, we need to pull together all the child queries at top level before any of the children render. I don't properly have access to any state I can use for this increateElement
. Previously, I'd just been readingbranch
at top-level and doing everything there: https://github.com/relay-tools/react-router-relay/blob/v0.4.2/src/RouteAggregator.js#L28-L58 - For each child component, I consider the relevant set of route parameters to be the ones for that route and all parents. I use these to construct the relevant queries for each of those routes (since they may well need access to params from parent routes, but should not have access to params from their children): https://github.com/relay-tools/react-router-relay/blob/v0.4.2/src/getParamsForRoute.js#L7-L12
Strictly speaking, I can hack my way around this: https://github.com/relay-tools/react-router-relay/pull/28/files. However, would it be possible to expose branch
to components again? (1) is a bit specific to Relay-style data fetching, but (2) might be useful more broadly.
I don't think I can the listen
hook on history
or set onUpdate
on Router
, because I need to observe the new branch synchronously with re-rendering the router.
Metadata
Metadata
Assignees
Labels
No labels