Skip to content

Commit

Permalink
Fix: 49f025
Browse files Browse the repository at this point in the history
- The previous commit did introduce a quick fix that only worked
  because a wrong call would always result in an undefined result
  and therefore use of the callback.
  This commit removes the ambiguity of the previous commit and
  makes the use of the CONNECTION_OPEN event mandatory.
  • Loading branch information
tsukasa committed Nov 11, 2023
1 parent 49f0252 commit c4d859c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
3 changes: 0 additions & 3 deletions frontend/src/modules/discordmodules.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ export default {
/* User Stores and Utils */
get UserStore() {return Webpack.getByProps("getCurrentUser", "getUser");},

/* Guild Info, Stores, and Utilities */
get GuildStore() {return Webpack.getByProps("getGuild");},

/* Electron & Other Internals with Utils */
get ElectronModule() {return Webpack.getByProps("setBadge");},
get Dispatcher() {return Webpack.getByProps("dispatch", "subscribe", "wait", "unsubscribe", "register");},
Expand Down
10 changes: 2 additions & 8 deletions frontend/src/modules/startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,8 @@ async function loadBetterDiscord() {
return true;
}

if (!DiscordModules.UserStore?.getCurrentUser() || !DiscordModules.GuildStore?.getGuilds()) {
Logger.log("Frontend", "getCurrentUser failed, registering callback.");
DiscordModules.Dispatcher.subscribe(connectionOpenEvent, callback);
}
else {
Logger.log("Frontend", "getCurrentUser succeeded, running setImmediate().");
setImmediate(callback);
}
Logger.log("Frontend", "Registering callback.");
DiscordModules.Dispatcher.subscribe(connectionOpenEvent, callback);

return true;
}
Expand Down

0 comments on commit c4d859c

Please sign in to comment.