import { Route, Switch } from "inferno-router";
import { IsoDataOptionalSite } from "../../interfaces";
import { routes } from "../../routes";
-import { I18NextService } from "../../services";
+import { FirstLoadService, I18NextService } from "../../services";
import AuthGuard from "../common/auth-guard";
import ErrorGuard from "../common/error-guard";
import { ErrorPage } from "./error-page";
<Navbar siteRes={siteRes} />
<div className="mt-4 p-0 fl-1">
<Switch>
- {routes.map(({ path, component: RouteComponent }) => (
- <Route
- key={path}
- path={path}
- exact
- component={routeProps => (
- <ErrorGuard>
- <main tabIndex={-1} ref={this.mainContentRef}>
- {RouteComponent &&
- (isAuthPath(path ?? "") ? (
- <AuthGuard>
- <RouteComponent {...routeProps} />
- </AuthGuard>
- ) : (
- <RouteComponent {...routeProps} />
- ))}
- </main>
- </ErrorGuard>
- )}
- />
- ))}
+ {routes.map(
+ ({ path, component: RouteComponent, fetchInitialData }) => (
+ <Route
+ key={path}
+ path={path}
+ exact
+ component={routeProps => {
+ if (!fetchInitialData) {
+ FirstLoadService.falsify();
+ }
+
+ return (
+ <ErrorGuard>
+ <main tabIndex={-1} ref={this.mainContentRef}>
+ {RouteComponent &&
+ (isAuthPath(path ?? "") ? (
+ <AuthGuard>
+ <RouteComponent {...routeProps} />
+ </AuthGuard>
+ ) : (
+ <RouteComponent {...routeProps} />
+ ))}
+ </main>
+ </ErrorGuard>
+ );
+ }}
+ />
+ )
+ )}
<Route component={ErrorPage} />
</Switch>
</div>
CreateCommunity as CreateCommunityI,
GetSiteResponse,
} from "lemmy-js-client";
-import { FirstLoadService, HttpService, I18NextService } from "../../services";
+import { HttpService, I18NextService } from "../../services";
import { HtmlTags } from "../common/html-tags";
import { CommunityForm } from "./community-form";
constructor(props: any, context: any) {
super(props, context);
this.handleCommunityCreate = this.handleCommunityCreate.bind(this);
-
- FirstLoadService.isFirstLoad;
}
get documentTitle(): string {
import { Component } from "inferno";
import { GetSiteResponse } from "lemmy-js-client";
import { mdToHtml } from "../../markdown";
-import { FirstLoadService, I18NextService } from "../../services";
+import { I18NextService } from "../../services";
import { HtmlTags } from "../common/html-tags";
interface LegalState {
constructor(props: any, context: any) {
super(props, context);
-
- FirstLoadService.isFirstLoad;
}
get documentTitle(): string {
import { validEmail } from "@utils/helpers";
import { Component, linkEvent } from "inferno";
import { GetSiteResponse, LoginResponse } from "lemmy-js-client";
-import { FirstLoadService, I18NextService, UserService } from "../../services";
+import { I18NextService, UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService";
import { toast } from "../../toast";
import { HtmlTags } from "../common/html-tags";
constructor(props: any, context: any) {
super(props, context);
-
- FirstLoadService.isFirstLoad;
}
componentDidMount() {
LoginResponse,
Register,
} from "lemmy-js-client";
-import { FirstLoadService, I18NextService, UserService } from "../../services";
+import { I18NextService, UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService";
import { Spinner } from "../common/icon";
import { SiteForm } from "./site-form";
super(props, context);
this.handleCreateSite = this.handleCreateSite.bind(this);
-
- FirstLoadService.isFirstLoad;
}
async componentDidMount() {
} from "lemmy-js-client";
import { joinLemmyUrl } from "../../config";
import { mdToHtml } from "../../markdown";
-import { FirstLoadService, I18NextService, UserService } from "../../services";
+import { I18NextService, UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService";
import { toast } from "../../toast";
import { HtmlTags } from "../common/html-tags";
super(props, context);
this.handleAnswerChange = this.handleAnswerChange.bind(this);
-
- FirstLoadService.isFirstLoad;
}
async componentDidMount() {
import { capitalizeFirstLetter } from "@utils/helpers";
import { Component, linkEvent } from "inferno";
import { GetSiteResponse, LoginResponse } from "lemmy-js-client";
-import {
- FirstLoadService,
- HttpService,
- I18NextService,
- UserService,
-} from "../../services";
+import { HttpService, I18NextService, UserService } from "../../services";
import { RequestState } from "../../services/HttpService";
import { HtmlTags } from "../common/html-tags";
import { Spinner } from "../common/icon";
constructor(props: any, context: any) {
super(props, context);
-
- FirstLoadService.isFirstLoad;
}
get documentTitle(): string {
SortType,
} from "lemmy-js-client";
import { elementUrl, emDash, relTags } from "../../config";
-import { FirstLoadService, UserService } from "../../services";
+import { UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService";
import { I18NextService, languages } from "../../services/I18NextService";
import { setupTippy } from "../../tippy";
this.handleBlockPerson = this.handleBlockPerson.bind(this);
this.handleBlockCommunity = this.handleBlockCommunity.bind(this);
- FirstLoadService.isFirstLoad;
-
const mui = UserService.Instance.myUserInfo;
if (mui) {
const {
import { setIsoData } from "@utils/app";
import { Component } from "inferno";
import { GetSiteResponse, VerifyEmailResponse } from "lemmy-js-client";
-import { FirstLoadService, I18NextService } from "../../services";
+import { I18NextService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService";
import { toast } from "../../toast";
import { HtmlTags } from "../common/html-tags";
constructor(props: any, context: any) {
super(props, context);
-
- FirstLoadService.isFirstLoad;
}
async verify() {
return isFirst;
}
+ falsify() {
+ this.#isFirstLoad = false;
+ }
+
static get #Instance() {
return this.#instance ?? (this.#instance = new this());
}
static get isFirstLoad() {
return !isBrowser() || this.#Instance.isFirstLoad;
}
+
+ static falsify() {
+ this.#Instance.falsify();
+ }
}