don't clear UserStore on non-existant preference field, fix unlinking not removing items from source

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2021-04-30 09:07:51 -04:00
1 parent 9f3d6e3e3c
commit 05fbdb070d
2 files changed
+2 -6

No files matched your search

-6
View File
@@ -238,23 +238,17 @@ export class UserStore extends BaseStore<UserStoreModel> {
this.kubectlBinariesPath = preferences.kubectlBinariesPath;
this.openAtLogin = preferences.openAtLogin;
this.hiddenTableColumns.clear();
if (preferences.hiddenTableColumns) {
this.hiddenTableColumns.replace(
preferences.hiddenTableColumns
.map(([tableId, columnIds]) => [tableId, new ObservableToggleSet(columnIds)])
);
} else {
this.hiddenTableColumns.clear();
}
if (preferences.syncKubeconfigEntries) {
this.syncKubeconfigEntries.replace(
preferences.syncKubeconfigEntries.map(({ filePath, ...rest }) => [filePath, rest])
);
} else {
this.syncKubeconfigEntries.clear();
}
}
@@ -242,6 +242,8 @@ async function watchFileChanges(filePath: string, port: number): Promise<[ICompu
})
.on("unlink", (childFilePath) => {
stoppers.get(childFilePath)();
stoppers.delete(childFilePath);
rootSource.delete(childFilePath);
})
.on("error", error => logger.error(`${logPrefix} watching file/folder failed: ${error}`, { filePath }));