2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-11-17 18:52:06 +00:00

chore: preselect zone in inspect zonelist if the assets for it are already loaded

* Relevant when navigating back for example
This commit is contained in:
Jan Laupetin
2025-10-27 21:14:13 +01:00
parent b299269949
commit 95aaf9fe94
2 changed files with 18 additions and 0 deletions

View File

@@ -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) {

View File

@@ -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<string | null>(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) => {