diff --git a/src/ModManUi/src/stores/AssetStore.ts b/src/ModManUi/src/stores/AssetStore.ts index 52762b02..80117f97 100644 --- a/src/ModManUi/src/stores/AssetStore.ts +++ b/src/ModManUi/src/stores/AssetStore.ts @@ -12,8 +12,14 @@ export const useAssetStore = defineStore("asset", () => { const referenceCount = computed(() => assetsOfZone.value?.references.length ?? 0); function loadAssetsForZone(newZoneName: string | null) { + // Skip if assets are already loaded + if (newZoneName === zoneName.value) return; + + // Reset current state zoneName.value = newZoneName; assetsOfZone.value = null; + + // Only load assets when there is a new zone name specified if (!newZoneName) return; webviewBinds.getAssetsForZone(newZoneName).then((res) => { if (zoneName.value === newZoneName) { diff --git a/src/ModManUi/src/view/inspect/ZoneInspector.vue b/src/ModManUi/src/view/inspect/ZoneInspector.vue index 67c6ca45..ed626058 100644 --- a/src/ModManUi/src/view/inspect/ZoneInspector.vue +++ b/src/ModManUi/src/view/inspect/ZoneInspector.vue @@ -3,10 +3,22 @@ import { ref, watch } from "vue"; import { useZoneStore } from "@/stores/ZoneStore"; import ZoneInspectorDetails from "./ZoneInspectorDetails.vue"; import ZoneInspectorZoneList from "./ZoneInspectorZoneList.vue"; +import { useAssetStore } from "@/stores/AssetStore"; +const assetStore = useAssetStore(); const zoneStore = useZoneStore(); + const selectedZone = ref(null); +// Make sure we preselect the zone that was last loaded assets for +// if there is one +if ( + assetStore.zoneName && + zoneStore.loadedZones.findIndex((zone) => zone.name === assetStore.zoneName) >= 0 +) { + selectedZone.value = assetStore.zoneName; +} + watch( () => zoneStore.loadedZones, (newValue) => {