Skip to content
This repository was archived by the owner on Aug 7, 2023. It is now read-only.

Commit e85a28f

Browse files
fix: prevent a spurious config change handler from firing
1 parent 0cad5f4 commit e85a28f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/config.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const Config = {
1818

1919
initialize () {
2020
if (this.initialized) { return; }
21+
this._currentConfig = null;
2122
this.rescan();
2223
this.initialized = true;
2324
},
@@ -29,7 +30,6 @@ const Config = {
2930
}
3031
this.subscriptions = new CompositeDisposable();
3132
this.overrides = {};
32-
this._currentConfig = null;
3333
this.configFile = null;
3434

3535
for (let dir of atom.project.getDirectories()) {
@@ -89,8 +89,10 @@ const Config = {
8989
triggerConfigChange () {
9090
let newConfig = this.get();
9191
if (!configChanged(newConfig, this._currentConfig)) { return; }
92-
for (let handler of this.handlers) {
93-
handler(newConfig, this._currentConfig || {});
92+
if (this._currentConfig) {
93+
for (let handler of this.handlers) {
94+
handler(newConfig, this._currentConfig || {});
95+
}
9496
}
9597
this._currentConfig = newConfig;
9698
},

0 commit comments

Comments
 (0)