- {routes.map(({ path, component }) => (
- <Route key={path} path={path} exact component={component} />
- ))}
- <Route component={NoMatch} />
+ {routes.map(
+ ({ path, component: RouteComponent, fetchInitialData }) => (
+ <Route
+ key={path}
+ path={path}
+ exact
+ component={routeProps => {
+ if (!fetchInitialData) {
+ FirstLoadService.falsify();
+ }
+
+ return (
+ <ErrorGuard>
+ <div tabIndex={-1}>
+ {RouteComponent &&
+ (isAuthPath(path ?? "") ? (
+ <AuthGuard>
+ <RouteComponent {...routeProps} />
+ </AuthGuard>
+ ) : (
+ <RouteComponent {...routeProps} />
+ ))}
+ </div>
+ </ErrorGuard>
+ );
+ }}
+ />
+ )
+ )}
+ <Route component={ErrorPage} />