Skip to content

Commit

Permalink
Remove awaitAllRouteRenderers functionality
Browse files Browse the repository at this point in the history
There's no reason to await the route renderers of our initial routes now
that suspense and preloading works properly.
  • Loading branch information
Kingdutch committed Jun 28, 2022
1 parent 028ce55 commit 0ce6211
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 11 deletions.
8 changes: 1 addition & 7 deletions router/RelayRouter.res
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,7 @@ module Router = {
}
},
postRouterEvent: postRouterEvent,
},
() => {
initialMatches
->Belt.Array.map(({route}) => route.loadRouteRenderer())
->Js.Promise.all
->Js.Promise.then_(_ => Js.Promise.resolve(), _)
},
}
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion router/RelayRouter.resi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module Router: {
~routes: array<Types.route>,
~routerEnvironment: RouterEnvironment.t,
~environment: RescriptRelay.Environment.t,
) => (Types.cleanupFn, Types.routerContext, Types.awaitAllRouteRenderers)
) => (Types.cleanupFn, Types.routerContext)
}

module Provider: {
Expand Down
1 change: 0 additions & 1 deletion router/RelayRouter__Types.res
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ type subFn = currentRouterEntry => unit
type unsubFn = unit => unit
type cleanupFn = unit => unit
type callback = unit => unit
type awaitAllRouteRenderers = unit => Js.Promise.t<unit>

type routerEvent =
| OnBeforeNavigation({currentLocation: RelayRouter__Bindings.History.location})
Expand Down
2 changes: 1 addition & 1 deletion src/EntryClient.res
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ let boot = () => {
Js.log("[debug] Doing boot")

RelaySSRUtils.bootOnClient(~rootElementId="root", ~render=() => {
let (_, routerContext, _) = RelayRouter.Router.make(
let (_, routerContext) = RelayRouter.Router.make(
~routes,
~environment=RelayEnv.environment,
~routerEnvironment,
Expand Down
2 changes: 1 addition & 1 deletion src/EntryServer.res
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ let default = (~request, ~response, ~clientScripts) => {

let routes = RouteDeclarations.make()

let (cleanup, routerContext, _) = RelayRouter.Router.make(
let (cleanup, routerContext) = RelayRouter.Router.make(
~routes,
~environment,
~routerEnvironment,
Expand Down

0 comments on commit 0ce6211

Please sign in to comment.