From: Alec Armbruster Date: Thu, 15 Jun 2023 16:29:24 +0000 (-0400) Subject: go back if last history action was push, fix bug preventing navigation to / working... X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%22https:/nerdica.net/%7BimageUploadUrl%7D?a=commitdiff_plain;h=4da9bcd7936f899c69c57a0e5a0e6bde853593ec;p=lemmy-ui.git go back if last history action was push, fix bug preventing navigation to / working from login --- diff --git a/src/shared/components/home/home.tsx b/src/shared/components/home/home.tsx index 8be9830..1abb1ee 100644 --- a/src/shared/components/home/home.tsx +++ b/src/shared/components/home/home.tsx @@ -244,9 +244,10 @@ export class Home extends Component { } async componentDidMount() { - if (!this.state.isIsomorphic) { + if (!this.state.isIsomorphic || !this.isoData.routeData.length) { await Promise.all([this.fetchTrendingCommunities(), this.fetchData()]); } + setupTippy(); } @@ -456,7 +457,7 @@ export class Home extends Component { } trendingCommunities(isMobile = false) { - switch (this.state.trendingCommunitiesRes.state) { + switch (this.state.trendingCommunitiesRes?.state) { case "loading": return (
@@ -573,7 +574,7 @@ export class Home extends Component { const siteRes = this.state.siteRes; if (dataType === DataType.Post) { - switch (this.state.postsRes.state) { + switch (this.state.postsRes?.state) { case "loading": return (
diff --git a/src/shared/components/home/login.tsx b/src/shared/components/home/login.tsx index 9491554..2997215 100644 --- a/src/shared/components/home/login.tsx +++ b/src/shared/components/home/login.tsx @@ -186,7 +186,9 @@ export class Login extends Component { UserService.Instance.myUserInfo = site.data.my_user; } - i.props.history.replace("/"); + i.props.history.action === "PUSH" + ? i.props.history.back() + : i.props.history.push("/"); break; }