diff --git a/app/web/src/store/asset.store.ts b/app/web/src/store/asset.store.ts index 5e1fbb0b39..b5c8bb0836 100644 --- a/app/web/src/store/asset.store.ts +++ b/app/web/src/store/asset.store.ts @@ -2,7 +2,6 @@ import { watch } from "vue"; import { defineStore } from "pinia"; import * as _ from "lodash-es"; import { addStoreHooks, ApiRequest } from "@si/vue-lib/pinia"; -import storage from "local-storage-fallback"; // drop-in storage polyfill which falls back to cookies/memory import { useWorkspacesStore } from "@/store/workspaces.store"; import { FuncKind } from "@/api/sdf/dal/func"; import { Visibility } from "@/api/sdf/dal/visibility"; @@ -106,8 +105,6 @@ export type AssetCreateRequest = Omit< >; export type AssetCloneRequest = Visibility & { id: AssetId }; -const LOCAL_STORAGE_LAST_SELECTED_ASSET_ID_KEY = "si-open-asset-id"; - export const assetDisplayName = (asset: Asset | AssetListEntry) => (asset.displayName ?? "").length === 0 ? asset.name : asset.displayName; @@ -270,12 +267,6 @@ export const useAssetStore = () => { } }, - getLastSelectedAssetId(): AssetId | undefined { - return storage.getItem( - LOCAL_STORAGE_LAST_SELECTED_ASSET_ID_KEY, - ) as AssetId; - }, - openFunc(assetId: AssetId, funcId: FuncId) { const funcs = this.openAssetFuncIds[assetId] ?? []; if (!funcs.includes(funcId)) { diff --git a/app/web/src/store/components.store.ts b/app/web/src/store/components.store.ts index 9e72e6266b..7c89b971c4 100644 --- a/app/web/src/store/components.store.ts +++ b/app/web/src/store/components.store.ts @@ -530,23 +530,25 @@ export const useComponentsStore = (forceChangeSetId?: ChangeSetId) => { const schemaVariants = []; for (const schema of this.schemas) { for (const variant of schema.variants) { - if (!_.find(schemaVariants, { id: variant.id })) { - schemaVariants.push({ - id: variant.id, - name: variant.name, - builtin: variant.builtin, - isDefault: true, - componentType: variant.componentType, - color: variant.color, - category: variant.category, - inputSockets: variant.inputSockets, - outputSockets: variant.outputSockets, - updated_at: variant.updated_at, - created_at: variant.created_at, - displayName: variant.displayName, - description: variant.description, - schemaName: schema.name, - }); + if (variant.isDefault) { + if (!_.find(schemaVariants, { id: variant.id })) { + schemaVariants.push({ + id: variant.id, + name: variant.name, + builtin: variant.builtin, + isDefault: true, + componentType: variant.componentType, + color: variant.color, + category: variant.category, + inputSockets: variant.inputSockets, + outputSockets: variant.outputSockets, + updated_at: variant.updated_at, + created_at: variant.created_at, + displayName: variant.displayName, + description: variant.description, + schemaName: schema.name, + }); + } } } } diff --git a/app/web/src/store/func/funcs.store.ts b/app/web/src/store/func/funcs.store.ts index f96df502fe..22c2c3d9b2 100644 --- a/app/web/src/store/func/funcs.store.ts +++ b/app/web/src/store/func/funcs.store.ts @@ -788,7 +788,7 @@ export const useFuncStore = () => { if (data.changeSetId !== selectedChangeSetId) return; this.FETCH_FUNC_LIST(); - const assetId = assetStore.getLastSelectedAssetId(); + const assetId = assetStore.selectedAssetId; if ( assetId && this.selectedFuncId && @@ -814,7 +814,7 @@ export const useFuncStore = () => { this.FETCH_FUNC_LIST(); // Reload the last selected asset to ensure that its func list is up to date. - const assetId = assetStore.getLastSelectedAssetId(); + const assetId = assetStore.selectedAssetId; if (assetId) { assetStore.LOAD_ASSET(assetId); }