mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-19 14:53:50 +02:00
Update UI on instance fetch
This commit is contained in:
@@ -95,7 +95,7 @@
|
|||||||
|
|
||||||
const mergedPaginationProps = computed(() => ({
|
const mergedPaginationProps = computed(() => ({
|
||||||
layout: 'sizes, prev, pager, next, total',
|
layout: 'sizes, prev, pager, next, total',
|
||||||
pageSizes: [20, 50, 100, 200],
|
pageSizes: [10, 15, 20, 25, 50, 100],
|
||||||
small: true,
|
small: true,
|
||||||
...paginationProps.value
|
...paginationProps.value
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { Loading, Lock, WarnTriangleFilled } from '@element-plus/icons-vue';
|
import { Loading, Lock, WarnTriangleFilled } from '@element-plus/icons-vue';
|
||||||
import { ref, watchEffect } from 'vue';
|
import { ref, watchEffect, watch } from 'vue';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { getGroupName, getWorldName, parseLocation } from '../shared/utils';
|
import { getGroupName, getWorldName, parseLocation } from '../shared/utils';
|
||||||
import { useGroupStore, useInstanceStore, useSearchStore, useWorldStore } from '../stores';
|
import { useGroupStore, useInstanceStore, useSearchStore, useWorldStore } from '../stores';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
const { showPreviousInstancesInfoDialog } = useInstanceStore();
|
const { showPreviousInstancesInfoDialog } = useInstanceStore();
|
||||||
const { verifyShortName } = useSearchStore();
|
const { verifyShortName } = useSearchStore();
|
||||||
const { cachedInstances } = useInstanceStore();
|
const { cachedInstances } = useInstanceStore();
|
||||||
|
const { lastInstanceApplied } = storeToRefs(useInstanceStore());
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
location: String,
|
location: String,
|
||||||
@@ -63,6 +65,16 @@
|
|||||||
parse();
|
parse();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => lastInstanceApplied.value,
|
||||||
|
(instanceId) => {
|
||||||
|
if (instanceId === currentInstanceId()) {
|
||||||
|
parse();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
function currentInstanceId() {
|
function currentInstanceId() {
|
||||||
if (typeof props.traveling !== 'undefined' && props.location === 'traveling') {
|
if (typeof props.traveling !== 'undefined' && props.location === 'traveling') {
|
||||||
return props.traveling;
|
return props.traveling;
|
||||||
|
|||||||
@@ -16,11 +16,13 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { Lock, Unlock, WarnTriangleFilled } from '@element-plus/icons-vue';
|
import { Lock, Unlock, WarnTriangleFilled } from '@element-plus/icons-vue';
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
import { getGroupName, parseLocation } from '../shared/utils';
|
import { getGroupName, parseLocation } from '../shared/utils';
|
||||||
import { useGroupStore, useLaunchStore, useInstanceStore } from '../stores';
|
import { useGroupStore, useLaunchStore, useInstanceStore } from '../stores';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { cachedInstances } = useInstanceStore();
|
const { cachedInstances } = useInstanceStore();
|
||||||
|
const { lastInstanceApplied } = storeToRefs(useInstanceStore());
|
||||||
|
|
||||||
const launchStore = useLaunchStore();
|
const launchStore = useLaunchStore();
|
||||||
const groupStore = useGroupStore();
|
const groupStore = useGroupStore();
|
||||||
@@ -95,6 +97,16 @@
|
|||||||
|
|
||||||
watch(() => props.locationobject, parse, { immediate: true });
|
watch(() => props.locationobject, parse, { immediate: true });
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => lastInstanceApplied.value,
|
||||||
|
(instanceId) => {
|
||||||
|
if (instanceId === location.value) {
|
||||||
|
parse();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ immediate: true }
|
||||||
|
);
|
||||||
|
|
||||||
function showLaunchDialog() {
|
function showLaunchDialog() {
|
||||||
launchStore.showLaunchDialog(location.value, shortName.value);
|
launchStore.showLaunchDialog(location.value, shortName.value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import { computed, reactive, watch } from 'vue';
|
import { computed, reactive, watch, ref } from 'vue';
|
||||||
import { ElMessage } from 'element-plus';
|
import { ElMessage } from 'element-plus';
|
||||||
import { instanceRequest, userRequest, worldRequest } from '../api';
|
import { instanceRequest, userRequest, worldRequest } from '../api';
|
||||||
import configRepository from '../service/config';
|
import configRepository from '../service/config';
|
||||||
@@ -82,6 +82,8 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
|
|
||||||
let cachedInstances = new Map();
|
let cachedInstances = new Map();
|
||||||
|
|
||||||
|
const lastInstanceApplied = ref('');
|
||||||
|
|
||||||
const currentInstanceWorld = computed({
|
const currentInstanceWorld = computed({
|
||||||
get: () => state.currentInstanceWorld,
|
get: () => state.currentInstanceWorld,
|
||||||
set: (value) => {
|
set: (value) => {
|
||||||
@@ -417,6 +419,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
groupInstance.instance = ref;
|
groupInstance.instance = ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
lastInstanceApplied.value = ref.id;
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1230,6 +1233,7 @@ export const useInstanceStore = defineStore('Instance', () => {
|
|||||||
state,
|
state,
|
||||||
|
|
||||||
cachedInstances,
|
cachedInstances,
|
||||||
|
lastInstanceApplied,
|
||||||
currentInstanceWorld,
|
currentInstanceWorld,
|
||||||
currentInstanceLocation,
|
currentInstanceLocation,
|
||||||
queuedInstances,
|
queuedInstances,
|
||||||
|
|||||||
Reference in New Issue
Block a user