Skip to content

Commit

Permalink
Fix it properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Nov 4, 2024
1 parent 60c2188 commit 8a73c4f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/plugins/keepCurrentChannel/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import * as DataStore from "@api/DataStore";
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
import { ChannelRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common";
import { ChannelRouter, ChannelStore, NavigationRouter, SelectedChannelStore, SelectedGuildStore } from "@webpack/common";

export interface LogoutEvent {
type: "LOGOUT";
Expand Down Expand Up @@ -65,7 +65,11 @@ export default definePlugin({
isSwitchingAccount = false;

if (previousCache?.channelId) {
ChannelRouter.transitionToChannel(previousCache.channelId);
if (ChannelStore.hasChannel(previousCache.channelId)) {
ChannelRouter.transitionToChannel(previousCache.channelId);
} else {
NavigationRouter.transitionToGuild("@me");
}
}
},

Expand Down

0 comments on commit 8a73c4f

Please sign in to comment.