Skip to content

Commit

Permalink
Merge branch 'dev' into sqaaakoi-stable-v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sqaaakoi committed Nov 5, 2024
2 parents 6e7c151 + 439a4f8 commit ab2d686
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vencord",
"private": "true",
"version": "1.10.5",
"version": "1.10.6",
"description": "The cutest Discord client mod",
"homepage": "https://github.com/Vendicated/Vencord#readme",
"bugs": {
Expand Down
18 changes: 16 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 All @@ -45,6 +45,16 @@ export default definePlugin({
description: "Attempt to navigate to the channel you were in before switching accounts or loading Discord.",
authors: [Devs.Nuckyz],

patches: [
{
find: '"Switching accounts"',
replacement: {
match: /goHomeAfterSwitching:\i/,
replace: "goHomeAfterSwitching:!1"
}
}
],

flux: {
LOGOUT(e: LogoutEvent) {
({ isSwitchingAccount } = e);
Expand All @@ -55,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 ab2d686

Please sign in to comment.