Skip to content

Commit 878629d

Browse files
committed
Avoid sending async updates on config update
In atom@7a5d727 the 'set-user-settings' callback was changed so that it nolonger returned the promise created by `ConfigFile.update()`. This meant that the logic in [`ApplicateDelegate.onDidChangeUserSetting()`](https://github.com/atom/atom/blob/5f0231b/src/application-delegate.js#L193-L206) which uses `.pendingSettingUpdateCount` to avoid triggering in response to calls to ApplicationDelegate.setUserSettings` was no longer effective. I noticed this when updating settings via the setting view. If you type at just the right (wrong?) cadence, you'll notice that your input can get updated with stale values. Something like this: ``` You type "a" "b" "c" config.set "a" "ab" "ac" config.observe "a" "ab" "ac" Input value "a" "ab" "a" "ac" "ab" "ac" ``` It's possible that is the same as atom/settings-view#1062 After this change typing in settings input seems to behave as expected.
1 parent aad7705 commit 878629d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main-process/atom-application.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ class AtomApplication extends EventEmitter {
576576

577577
this.disposable.add(ipcHelpers.respondTo('set-user-settings', (window, settings, filePath) => {
578578
if (!this.quitting) {
579-
ConfigFile.at(filePath || this.configFilePath).update(JSON.parse(settings))
579+
return ConfigFile.at(filePath || this.configFilePath).update(JSON.parse(settings))
580580
}
581581
}))
582582

0 commit comments

Comments
 (0)