Move FileSystemProvisionerStore to new format

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2023-03-22 15:50:11 -04:00
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