Use a counter instead of the current time for modal IDs to avoid duplicates when multiple modals are opened at the same time
This commit is contained in:
parent
821f46481e
commit
27f1eec967
|
@ -11,7 +11,7 @@
|
|||
import { DOM, BdUI, BdMenu, Modals, Reflection } from 'ui';
|
||||
import BdCss from './styles/index.scss';
|
||||
import { Events, CssEditor, Globals, Settings, Database, Updater, ModuleManager, PluginManager, ThemeManager, ExtModuleManager, Vendor, WebpackModules, Patcher, MonkeyPatch, ReactComponents, ReactHelpers, ReactAutoPatcher, DiscordApi } from 'modules';
|
||||
import { ClientLogger as Logger, ClientIPC, Utils } from 'common';
|
||||
import { ClientLogger as Logger, ClientIPC, Utils, IterableWeakCollections, IterableWeakMap, IterableWeakSet } from 'common';
|
||||
import { EmoteModule } from 'builtin';
|
||||
import electron from 'electron';
|
||||
import path from 'path';
|
||||
|
@ -37,6 +37,7 @@ class BetterDiscord {
|
|||
EmoteModule,
|
||||
|
||||
Logger, ClientIPC, Utils,
|
||||
IterableWeakCollections, IterableWeakMap, IterableWeakSet,
|
||||
|
||||
plugins: PluginManager.localContent,
|
||||
themes: ThemeManager.localContent,
|
||||
|
|
|
@ -51,7 +51,7 @@ export default class KeybindSetting extends Setting {
|
|||
get addEventListener() { return this.on }
|
||||
get removeEventListener() { return this.removeListener }
|
||||
|
||||
static _setup() {
|
||||
static _init() {
|
||||
document.addEventListener('keydown', this.__event_handler.bind(this, 'keydown'));
|
||||
document.addEventListener('keyup', this.__event_handler.bind(this, 'keyup'));
|
||||
document.addEventListener('keypress', this.__event_handler.bind(this, 'keypress'));
|
||||
|
@ -73,4 +73,4 @@ export default class KeybindSetting extends Setting {
|
|||
|
||||
}
|
||||
|
||||
KeybindSetting._setup();
|
||||
KeybindSetting._init();
|
||||
|
|
|
@ -17,6 +17,8 @@ import ErrorModal from './components/bd/modals/ErrorModal.vue';
|
|||
import SettingsModal from './components/bd/modals/SettingsModal.vue';
|
||||
import PermissionModal from './components/bd/modals/PermissionModal.vue';
|
||||
|
||||
let modals = 0;
|
||||
|
||||
class Modal extends AsyncEventEmitter {
|
||||
constructor(_modal, component) {
|
||||
super();
|
||||
|
@ -36,7 +38,7 @@ class Modal extends AsyncEventEmitter {
|
|||
};
|
||||
|
||||
this.closing = false;
|
||||
this.id = Date.now();
|
||||
this.id = modals++;
|
||||
this.vueInstance = undefined;
|
||||
this.vue = undefined;
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ export class IterableWeakCollections {
|
|||
return new Set(this.getWeakSetValues(ws));
|
||||
}
|
||||
|
||||
static _setup() {
|
||||
static _init() {
|
||||
const v8 = process.binding('v8');
|
||||
|
||||
// Enable natives syntax
|
||||
|
@ -158,4 +158,4 @@ export class IterableWeakCollections {
|
|||
|
||||
}
|
||||
|
||||
IterableWeakCollections._setup();
|
||||
IterableWeakCollections._init();
|
||||
|
|
Loading…
Reference in New Issue