mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Remove getOrDefault from ExtendedObservableMap (#2836)
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
353a166b1e
commit
45d74b8c3a
2 files changed
+5
-27
No files matched your search
@@ -255,17 +255,17 @@ async function watchFileChanges(filePath: string): Promise<[IComputedValue<Catal
|
||||
depth: stat.isDirectory() ? 0 : 1, // DIRs works with 0 but files need 1 (bug: https://github.com/paulmillr/chokidar/issues/1095)
|
||||
disableGlobbing: true,
|
||||
});
|
||||
const rootSource = new ExtendedObservableMap<string, ObservableMap<string, RootSourceValue>>(observable.map);
|
||||
const rootSource = new ExtendedObservableMap<string, ObservableMap<string, RootSourceValue>>();
|
||||
const derivedSource = computed(() => Array.from(iter.flatMap(rootSource.values(), from => iter.map(from.values(), child => child[1]))));
|
||||
const stoppers = new Map<string, Disposer>();
|
||||
|
||||
watcher
|
||||
.on("change", (childFilePath) => {
|
||||
stoppers.get(childFilePath)();
|
||||
stoppers.set(childFilePath, diffChangedConfig(childFilePath, rootSource.getOrDefault(childFilePath)));
|
||||
stoppers.set(childFilePath, diffChangedConfig(childFilePath, rootSource.getOrInsert(childFilePath, observable.map)));
|
||||
})
|
||||
.on("add", (childFilePath) => {
|
||||
stoppers.set(childFilePath, diffChangedConfig(childFilePath, rootSource.getOrDefault(childFilePath)));
|
||||
stoppers.set(childFilePath, diffChangedConfig(childFilePath, rootSource.getOrInsert(childFilePath, observable.map)));
|
||||
})
|
||||
.on("unlink", (childFilePath) => {
|
||||
stoppers.get(childFilePath)();
|
||||
|
||||
Reference in new issue
Block a user