1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

Rename helper function to better communicate intent

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton 2023-03-31 15:17:50 -04:00
parent 6dd41c13ba
commit 67da7d7f5b
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ import emitAppEventInjectable from "../../../../common/app-event-bus/emit-event.
import type { ClusterModel } from "../../../../common/cluster-types";
import { Cluster } from "../../../../common/cluster/cluster";
import clustersStateInjectable from "./state.injectable";
import { setAndInsert } from "@k8slens/utilities";
import { setAndGet } from "@k8slens/utilities";
export type AddCluster = (clusterModel: ClusterModel) => Cluster;
@ -21,7 +21,7 @@ const addClusterInjectable = getInjectable({
return action((clusterModel) => {
emitAppEvent({ name: "cluster", action: "add" });
return setAndInsert(clustersState, clusterModel.id, new Cluster(clusterModel));
return setAndGet(clustersState, clusterModel.id, new Cluster(clusterModel));
});
},
});

View File

@ -88,7 +88,7 @@ export async function getOrInsertWithAsync<K, V>(map: Map<K, V>, key: K, asyncBu
/**
* Insert `val` into `map` under `key` and then get the value back
*/
export function setAndInsert<K, V>(map: Map<K, V>, key: K, val: V): V {
export function setAndGet<K, V>(map: Map<K, V>, key: K, val: V): V {
map.set(key, val);
return map.get(key)!;