You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/rescript-relay-router/README.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -221,6 +221,17 @@ let renderer = Routes.Shell.Route.makeRenderer(
221
221
222
222
Slot routes are still regular routes. They use their normal route renderer, `prepare`, `prepareCode`, query params, path params, links, and preloading. The `outlet` property only controls where the matched branch renders.
223
223
224
+
The generated route declarations also expose a root-scoped `outletForUrl` helper:
225
+
226
+
```rescript
227
+
let renderTarget = switch RouteDeclarations.Shell.outletForUrl("/preferences/account") {
228
+
| Some(Overlay) => "overlay"
229
+
| Some(_) | None => "primary"
230
+
}
231
+
```
232
+
233
+
`outletForUrl` uses the same route matcher as the runtime router and returns the deepest matched route's effective outlet as a typed outlet variant. Effective outlets are inherited by descendants, so a child route under an outlet route reports the same outlet even when the child does not repeat the `outlet` field.
234
+
224
235
This initial implementation supports one active outlet branch per matched URL. A route tree may declare multiple slots, but a single URL match can only split once into the first descendant route that declares `outlet`.
225
236
226
237
To create a "catch all" route, use the `*`, character as the route path. Typically used for the "not found" route. Example:
~message=`"RelayRouter" cannot be used as an entrypoint route name because it would shadow the router runtime module in generated route declarations.`,
908
+
~message=`"RelayRouter" cannot be used as a top-level route name because it would shadow the router runtime module in generated route declarations.`,
0 commit comments