go back if last history action was push, fix bug preventing navigation to / working from login

This commit is contained in:
Alec Armbruster 2023-06-15 12:29:24 -04:00
parent de4b1a0518
commit 4da9bcd793
No known key found for this signature in database
GPG key ID: 0BE3206ADE0F3B3B
2 changed files with 7 additions and 4 deletions

View file

@ -244,9 +244,10 @@ export class Home extends Component<any, HomeState> {
}
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<any, HomeState> {
}
trendingCommunities(isMobile = false) {
switch (this.state.trendingCommunitiesRes.state) {
switch (this.state.trendingCommunitiesRes?.state) {
case "loading":
return (
<h5>
@ -573,7 +574,7 @@ export class Home extends Component<any, HomeState> {
const siteRes = this.state.siteRes;
if (dataType === DataType.Post) {
switch (this.state.postsRes.state) {
switch (this.state.postsRes?.state) {
case "loading":
return (
<h5>

View file

@ -186,7 +186,9 @@ export class Login extends Component<any, State> {
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;
}