- {routes.map(({ path, exact, component: C, ...rest }) => (
- <Route
- key={path}
- path={path}
- exact={exact}
- render={props => <C {...props} {...rest} />}
- />
- ))}
- <Route render={props => <NoMatch {...props} />} />
+ {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} />