Change instance fetching

This commit is contained in:
Natsumi
2025-10-05 23:37:19 +13:00
parent 3fd74ed800
commit 277ba22a87
3 changed files with 30 additions and 33 deletions

View File

@@ -25,7 +25,6 @@
import { ref, watchEffect } from 'vue';
import { getGroupName, getWorldName, parseLocation } from '../shared/utils';
import { useGroupStore, useInstanceStore, useSearchStore, useWorldStore } from '../stores';
import { instanceRequest } from '../api';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
@@ -33,6 +32,7 @@
const { showGroupDialog } = useGroupStore();
const { showPreviousInstancesInfoDialog } = useInstanceStore();
const { verifyShortName } = useSearchStore();
const { cachedInstances } = useInstanceStore();
const props = defineProps({
location: String,
@@ -89,21 +89,15 @@
return;
}
instanceRequest
.getCachedInstance({ worldId: L.worldId, instanceId: L.instanceId })
.then((args) => {
if (currentInstanceId() === L.tag) {
if (args.json.displayName) {
setText(L, args.json.displayName);
}
if (args.json.closedAt) {
isClosed.value = true;
}
}
})
.catch((e) => {
console.error(e);
});
const instanceRef = cachedInstances.get(L.tag);
if (typeof instanceRef !== 'undefined') {
if (instanceRef.displayName) {
setText(L, instanceRef.displayName);
}
if (instanceRef.closedAt) {
isClosed.value = true;
}
}
if (props.grouphint) {
groupName.value = props.grouphint;

View File

@@ -17,10 +17,10 @@
import { Lock, Unlock, WarnTriangleFilled } from '@element-plus/icons-vue';
import { ref, watch } from 'vue';
import { getGroupName, parseLocation } from '../shared/utils';
import { useGroupStore, useLaunchStore } from '../stores';
import { instanceRequest } from '../api';
import { useGroupStore, useLaunchStore, useInstanceStore } from '../stores';
import { useI18n } from 'vue-i18n';
const { t } = useI18n();
const { cachedInstances } = useInstanceStore();
const launchStore = useLaunchStore();
const groupStore = useGroupStore();
@@ -65,21 +65,15 @@
return;
}
instanceRequest
.getCachedInstance({ worldId: L.worldId, instanceId: L.instanceId })
.then((args) => {
if (locObj.tag === L.tag) {
if (args.json.displayName) {
instanceName.value = args.json.displayName;
}
if (args.json.closedAt) {
isClosed.value = true;
}
}
})
.catch((e) => {
console.error(e);
});
const instanceRef = cachedInstances.get(L.tag);
if (typeof instanceRef !== 'undefined') {
if (instanceRef.displayName) {
instanceName.value = instanceRef.displayName;
}
if (instanceRef.closedAt) {
isClosed.value = true;
}
}
if (props.grouphint) {
groupName.value = props.grouphint;

View File

@@ -646,6 +646,15 @@ export const useUserStore = defineStore('User', () => {
sharedFeedStore.updateSharedFeed(false);
}
}
if (
!instanceStore.cachedInstances.has(ref.$location.tag) &&
isRealInstance(ref.location)
) {
instanceRequest.getInstance({
worldId: ref.$location.worldId,
instanceId: ref.$location.instanceId
});
}
if (
ref.$isVRCPlus &&
ref.badges &&