mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Move FileSystemProvisionerStore to new format
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
f1f72b1021
commit
7fec6b0c08
8 files changed
+39
-87
No files matched your search
@@ -74,7 +74,11 @@ export function getOrInsertWith<K extends object, V>(map: Map<K, V> | WeakMap<K,
|
||||
*/
|
||||
export async function getOrInsertWithAsync<K, V>(map: Map<K, V>, key: K, asyncBuilder: () => Promise<V>): Promise<V> {
|
||||
if (!map.has(key)) {
|
||||
map.set(key, await asyncBuilder());
|
||||
const newValue = await asyncBuilder();
|
||||
|
||||
runInAction(() => {
|
||||
map.set(key, newValue);
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
|
||||
Reference in new issue
Block a user