diff --git a/src/server.tsx b/src/server.tsx index edaaff0..69eab8e 100644 --- a/src/server.tsx +++ b/src/server.tsx @@ -51,24 +51,23 @@ forward({ for (const { component } of routes) { const startPageEvent = getStart(component); - - if (startPageEvent) { - const matchedRoute = sample(routesMatched, sessionLoaded).filterMap( - ({ routes, query }) => { - const route = routes.find(routeWithEvent(startPageEvent)); - if (route) return { route, query }; - return undefined; - }, - ); - - forward({ - from: matchedRoute, - to: startPageEvent.prepend(({ route, query }) => ({ - params: route.match.params, - query, - })), - }); - } + if (!startPageEvent) continue; + + const matchedRoute = sample(routesMatched, sessionLoaded).filterMap( + ({ routes, query }) => { + const route = routes.find(routeWithEvent(startPageEvent)); + if (route) return { route, query }; + return undefined; + }, + ); + + forward({ + from: matchedRoute, + to: startPageEvent.prepend(({ route, query }) => ({ + params: route.match.params, + query, + })), + }); } sample({