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

Filtering out clusters by metadata.id (#3200)

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev 2021-06-28 18:28:54 +03:00 committed by GitHub
parent 0b88df9b36
commit c0dbd5878d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@
import { app } from "electron";
import fse from "fs-extra";
import { isNull } from "lodash";
import { isNull, uniqBy } from "lodash";
import path from "path";
import * as uuid from "uuid";
import type { ClusterStoreModel } from "../../common/cluster-store";
@ -47,6 +47,7 @@ export default {
const workspaceStoreData: Pre500WorkspaceStoreModel = fse.readJsonSync(path.join(userDataPath, "lens-workspace-store.json"));
const { clusters }: ClusterStoreModel = fse.readJSONSync(path.join(userDataPath, "lens-cluster-store.json"));
const workspaceHotbars = new Map<string, Hotbar>(); // mapping from WorkspaceId to HotBar
const uniqueClusters = uniqBy(clusters, "metadata.id"); // Filtering out duplicated clusters
for (const { id, name } of workspaceStoreData.workspaces) {
workspaceHotbars.set(id, {
@ -68,7 +69,7 @@ export default {
});
}
for (const cluster of clusters) {
for (const cluster of uniqueClusters) {
const workspaceHotbar = workspaceHotbars.get(cluster.workspace);
if (workspaceHotbar?.items.length < defaultHotbarCells) {