Merge pull request #1528 from LemmyNet/navigation-fix

Fix issue when navigating awat from settings
This commit is contained in:
SleeplessOne1917 2023-06-23 15:30:46 -04:00 committed by GitHub
commit 095294c915
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 9 deletions

View file

@ -4,7 +4,7 @@ import {
CreateCommunity as CreateCommunityI, CreateCommunity as CreateCommunityI,
GetSiteResponse, GetSiteResponse,
} from "lemmy-js-client"; } from "lemmy-js-client";
import { HttpService, I18NextService } from "../../services"; import { FirstLoadService, HttpService, I18NextService } from "../../services";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
import { CommunityForm } from "./community-form"; import { CommunityForm } from "./community-form";
@ -22,6 +22,8 @@ export class CreateCommunity extends Component<any, CreateCommunityState> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
this.handleCommunityCreate = this.handleCommunityCreate.bind(this); this.handleCommunityCreate = this.handleCommunityCreate.bind(this);
FirstLoadService.isFirstLoad;
} }
get documentTitle(): string { get documentTitle(): string {

View file

@ -2,7 +2,7 @@ import { setIsoData } from "@utils/app";
import { Component } from "inferno"; import { Component } from "inferno";
import { GetSiteResponse } from "lemmy-js-client"; import { GetSiteResponse } from "lemmy-js-client";
import { mdToHtml } from "../../markdown"; import { mdToHtml } from "../../markdown";
import { I18NextService } from "../../services"; import { FirstLoadService, I18NextService } from "../../services";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
interface LegalState { interface LegalState {
@ -17,6 +17,8 @@ export class Legal extends Component<any, LegalState> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
FirstLoadService.isFirstLoad;
} }
get documentTitle(): string { get documentTitle(): string {

View file

@ -3,7 +3,7 @@ import { isBrowser } from "@utils/browser";
import { validEmail } from "@utils/helpers"; import { validEmail } from "@utils/helpers";
import { Component, linkEvent } from "inferno"; import { Component, linkEvent } from "inferno";
import { GetSiteResponse, LoginResponse } from "lemmy-js-client"; import { GetSiteResponse, LoginResponse } from "lemmy-js-client";
import { I18NextService, UserService } from "../../services"; import { FirstLoadService, I18NextService, UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService"; import { HttpService, RequestState } from "../../services/HttpService";
import { toast } from "../../toast"; import { toast } from "../../toast";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
@ -32,6 +32,8 @@ export class Login extends Component<any, State> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
FirstLoadService.isFirstLoad;
} }
componentDidMount() { componentDidMount() {

View file

@ -7,7 +7,7 @@ import {
LoginResponse, LoginResponse,
Register, Register,
} from "lemmy-js-client"; } from "lemmy-js-client";
import { I18NextService, UserService } from "../../services"; import { FirstLoadService, I18NextService, UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService"; import { HttpService, RequestState } from "../../services/HttpService";
import { Spinner } from "../common/icon"; import { Spinner } from "../common/icon";
import { SiteForm } from "./site-form"; import { SiteForm } from "./site-form";
@ -47,6 +47,8 @@ export class Setup extends Component<any, State> {
super(props, context); super(props, context);
this.handleCreateSite = this.handleCreateSite.bind(this); this.handleCreateSite = this.handleCreateSite.bind(this);
FirstLoadService.isFirstLoad;
} }
async componentDidMount() { async componentDidMount() {

View file

@ -14,7 +14,7 @@ import {
} from "lemmy-js-client"; } from "lemmy-js-client";
import { joinLemmyUrl } from "../../config"; import { joinLemmyUrl } from "../../config";
import { mdToHtml } from "../../markdown"; import { mdToHtml } from "../../markdown";
import { I18NextService, UserService } from "../../services"; import { FirstLoadService, I18NextService, UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService"; import { HttpService, RequestState } from "../../services/HttpService";
import { toast } from "../../toast"; import { toast } from "../../toast";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
@ -84,6 +84,8 @@ export class Signup extends Component<any, State> {
super(props, context); super(props, context);
this.handleAnswerChange = this.handleAnswerChange.bind(this); this.handleAnswerChange = this.handleAnswerChange.bind(this);
FirstLoadService.isFirstLoad;
} }
async componentDidMount() { async componentDidMount() {

View file

@ -2,7 +2,12 @@ import { myAuth, setIsoData } from "@utils/app";
import { capitalizeFirstLetter } from "@utils/helpers"; import { capitalizeFirstLetter } from "@utils/helpers";
import { Component, linkEvent } from "inferno"; import { Component, linkEvent } from "inferno";
import { GetSiteResponse, LoginResponse } from "lemmy-js-client"; import { GetSiteResponse, LoginResponse } from "lemmy-js-client";
import { HttpService, I18NextService, UserService } from "../../services"; import {
FirstLoadService,
HttpService,
I18NextService,
UserService,
} from "../../services";
import { RequestState } from "../../services/HttpService"; import { RequestState } from "../../services/HttpService";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
import { Spinner } from "../common/icon"; import { Spinner } from "../common/icon";
@ -30,6 +35,8 @@ export class PasswordChange extends Component<any, State> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
FirstLoadService.isFirstLoad;
} }
get documentTitle(): string { get documentTitle(): string {

View file

@ -29,7 +29,7 @@ import {
SortType, SortType,
} from "lemmy-js-client"; } from "lemmy-js-client";
import { elementUrl, emDash, relTags } from "../../config"; import { elementUrl, emDash, relTags } from "../../config";
import { UserService } from "../../services"; import { FirstLoadService, UserService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService"; import { HttpService, RequestState } from "../../services/HttpService";
import { I18NextService, languages } from "../../services/I18NextService"; import { I18NextService, languages } from "../../services/I18NextService";
import { setupTippy } from "../../tippy"; import { setupTippy } from "../../tippy";
@ -170,6 +170,8 @@ export class Settings extends Component<any, SettingsState> {
this.handleBlockPerson = this.handleBlockPerson.bind(this); this.handleBlockPerson = this.handleBlockPerson.bind(this);
this.handleBlockCommunity = this.handleBlockCommunity.bind(this); this.handleBlockCommunity = this.handleBlockCommunity.bind(this);
FirstLoadService.isFirstLoad;
const mui = UserService.Instance.myUserInfo; const mui = UserService.Instance.myUserInfo;
if (mui) { if (mui) {
const { const {
@ -1177,7 +1179,6 @@ export class Settings extends Component<any, SettingsState> {
}); });
if (saveRes.state === "success") { if (saveRes.state === "success") {
UserService.Instance.login(saveRes.data); UserService.Instance.login(saveRes.data);
location.reload();
toast(I18NextService.i18n.t("saved")); toast(I18NextService.i18n.t("saved"));
window.scrollTo(0, 0); window.scrollTo(0, 0);
} }

View file

@ -1,7 +1,7 @@
import { setIsoData } from "@utils/app"; import { setIsoData } from "@utils/app";
import { Component } from "inferno"; import { Component } from "inferno";
import { GetSiteResponse, VerifyEmailResponse } from "lemmy-js-client"; import { GetSiteResponse, VerifyEmailResponse } from "lemmy-js-client";
import { I18NextService } from "../../services"; import { FirstLoadService, I18NextService } from "../../services";
import { HttpService, RequestState } from "../../services/HttpService"; import { HttpService, RequestState } from "../../services/HttpService";
import { toast } from "../../toast"; import { toast } from "../../toast";
import { HtmlTags } from "../common/html-tags"; import { HtmlTags } from "../common/html-tags";
@ -22,6 +22,8 @@ export class VerifyEmail extends Component<any, State> {
constructor(props: any, context: any) { constructor(props: any, context: any) {
super(props, context); super(props, context);
FirstLoadService.isFirstLoad;
} }
async verify() { async verify() {