this repo has no description

moonbase/stores: Fix possible race condition with event

Changed files
+7 -3
packages
core-extensions
src
moonbase
webpackModules
+7 -3
packages/core-extensions/src/moonbase/webpackModules/stores.ts
···
this.checkUpdates();
// Update our state if another extension edited the config programatically
-
moonlightNode.events.addEventListener(NodeEventType.ConfigSaved, async (config) => {
+
moonlightNode.events.addEventListener(NodeEventType.ConfigSaved, (config) => {
if (!this.submitting) {
this.config = this.clone(config);
-
await this.processConfigChanged();
-
this.emitChange();
+
// NOTE: This is also async but we're calling it without
+
this.processConfigChanged();
}
});
}
···
async writeConfig() {
try {
this.submitting = true;
+
this.emitChange();
+
await moonlightNode.writeConfig(this.config);
await this.processConfigChanged();
} finally {
···
const modifiedRepos = diff(this.savedConfig.repositories, this.config.repositories);
if (modifiedRepos.length !== 0) await this.checkUpdates();
+
+
this.emitChange();
}
reset() {