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:
@@ -12,8 +12,14 @@ export const useAssetStore = defineStore("asset", () => {
|
|||||||
const referenceCount = computed(() => assetsOfZone.value?.references.length ?? 0);
|
const referenceCount = computed(() => assetsOfZone.value?.references.length ?? 0);
|
||||||
|
|
||||||
function loadAssetsForZone(newZoneName: string | null) {
|
function loadAssetsForZone(newZoneName: string | null) {
|
||||||
|
// Skip if assets are already loaded
|
||||||
|
if (newZoneName === zoneName.value) return;
|
||||||
|
|
||||||
|
// Reset current state
|
||||||
zoneName.value = newZoneName;
|
zoneName.value = newZoneName;
|
||||||
assetsOfZone.value = null;
|
assetsOfZone.value = null;
|
||||||
|
|
||||||
|
// Only load assets when there is a new zone name specified
|
||||||
if (!newZoneName) return;
|
if (!newZoneName) return;
|
||||||
webviewBinds.getAssetsForZone(newZoneName).then((res) => {
|
webviewBinds.getAssetsForZone(newZoneName).then((res) => {
|
||||||
if (zoneName.value === newZoneName) {
|
if (zoneName.value === newZoneName) {
|
||||||
|
|||||||
@@ -3,10 +3,22 @@ import { ref, watch } from "vue";
|
|||||||
import { useZoneStore } from "@/stores/ZoneStore";
|
import { useZoneStore } from "@/stores/ZoneStore";
|
||||||
import ZoneInspectorDetails from "./ZoneInspectorDetails.vue";
|
import ZoneInspectorDetails from "./ZoneInspectorDetails.vue";
|
||||||
import ZoneInspectorZoneList from "./ZoneInspectorZoneList.vue";
|
import ZoneInspectorZoneList from "./ZoneInspectorZoneList.vue";
|
||||||
|
import { useAssetStore } from "@/stores/AssetStore";
|
||||||
|
|
||||||
|
const assetStore = useAssetStore();
|
||||||
const zoneStore = useZoneStore();
|
const zoneStore = useZoneStore();
|
||||||
|
|
||||||
const selectedZone = ref<string | null>(null);
|
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(
|
watch(
|
||||||
() => zoneStore.loadedZones,
|
() => zoneStore.loadedZones,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user