mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-01 20:53:45 +02:00
use action from store instead of directly modifying state in components
This commit is contained in:
@@ -319,6 +319,10 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
return ref;
|
||||
}
|
||||
|
||||
function resetCachedAvatarModerations() {
|
||||
cachedAvatarModerations.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -797,6 +801,7 @@ export const useAvatarStore = defineStore('Avatar', () => {
|
||||
|
||||
showAvatarDialog,
|
||||
applyAvatarModeration,
|
||||
resetCachedAvatarModerations,
|
||||
getAvatarGallery,
|
||||
updateVRChatAvatarCache,
|
||||
getAvatarHistory,
|
||||
|
||||
+11
-3
@@ -230,7 +230,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
state.friendNumber = 0;
|
||||
friendLog.clear();
|
||||
friendLogTable.value.data = [];
|
||||
groupStore.groupInstances = [];
|
||||
groupStore.clearGroupInstances();
|
||||
onlineFriendCount.value = 0;
|
||||
pendingOfflineMap.clear();
|
||||
if (isLoggedIn) {
|
||||
@@ -273,7 +273,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
|
||||
if (appearanceSettingsStore.randomUserColours) {
|
||||
getNameColour(userStore.currentUser.id).then((colour) => {
|
||||
userStore.currentUser.$userColour = colour;
|
||||
userStore.setCurrentUserColour(colour);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1684,6 +1684,13 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
function setRefreshFriendsLoading(value) {
|
||||
isRefreshFriendsLoading.value = value;
|
||||
}
|
||||
|
||||
return {
|
||||
state,
|
||||
|
||||
@@ -1725,6 +1732,7 @@ export const useFriendStore = defineStore('Friend', () => {
|
||||
updateUserCurrentStatus,
|
||||
handleFriendAdd,
|
||||
handleFriendDelete,
|
||||
initFriendLogHistoryTable
|
||||
initFriendLogHistoryTable,
|
||||
setRefreshFriendsLoading
|
||||
};
|
||||
});
|
||||
|
||||
@@ -962,6 +962,10 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
}
|
||||
}
|
||||
|
||||
function clearGroupInstances() {
|
||||
groupInstances.value = [];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {object} json
|
||||
@@ -1197,6 +1201,7 @@ export const useGroupStore = defineStore('Group', () => {
|
||||
loadCurrentUserGroups,
|
||||
handleGroupPost,
|
||||
handleGroupUserInstances,
|
||||
clearGroupInstances,
|
||||
handleGroupMember,
|
||||
handleGroupPermissions,
|
||||
handleGroupMemberProps,
|
||||
|
||||
@@ -193,7 +193,7 @@ export const useModerationStore = defineStore('Moderation', () => {
|
||||
})
|
||||
.then((res) => {
|
||||
// TODO: compare with cachedAvatarModerations
|
||||
avatarStore.cachedAvatarModerations = new Map();
|
||||
avatarStore.resetCachedAvatarModerations();
|
||||
if (res[1]?.json) {
|
||||
for (const json of res[1].json) {
|
||||
avatarStore.applyAvatarModeration(json);
|
||||
|
||||
@@ -442,7 +442,7 @@ export const useDiscordPresenceSettingsStore = defineStore(
|
||||
*/
|
||||
async function saveDiscordOption(configLabel = '') {
|
||||
state.lastLocationDetails.tag = '';
|
||||
updateLoopStore.nextDiscordUpdate = 3;
|
||||
updateLoopStore.setNextDiscordUpdate(3);
|
||||
updateDiscord();
|
||||
}
|
||||
|
||||
|
||||
@@ -379,7 +379,7 @@ export const useGeneralSettingsStore = defineStore('GeneralSettings', () => {
|
||||
})
|
||||
.then(async ({ ok, value }) => {
|
||||
if (ok) {
|
||||
vrcxStore.proxyServer = value;
|
||||
vrcxStore.setProxyServer(value);
|
||||
await VRCXStorage.Set(
|
||||
'VRCX_ProxyServer',
|
||||
vrcxStore.proxyServer
|
||||
|
||||
@@ -98,7 +98,7 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
vrcxStore.tryAutoBackupVrcRegistry();
|
||||
}
|
||||
if (--state.ipcTimeout <= 0) {
|
||||
vrcxStore.ipcEnabled = false;
|
||||
vrcxStore.setIpcEnabled(false);
|
||||
}
|
||||
if (
|
||||
--state.nextClearVRCXCacheCheck <= 0 &&
|
||||
@@ -141,7 +141,7 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
friendStore.isRefreshFriendsLoading = false;
|
||||
friendStore.setRefreshFriendsLoading(false);
|
||||
console.error(err);
|
||||
}
|
||||
workerTimers.setTimeout(() => updateLoop(), 1000);
|
||||
@@ -155,6 +155,10 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
state.nextGroupInstanceRefresh = value;
|
||||
}
|
||||
|
||||
function setNextDiscordUpdate(value) {
|
||||
state.nextDiscordUpdate = value;
|
||||
}
|
||||
|
||||
return {
|
||||
// state,
|
||||
|
||||
@@ -163,6 +167,7 @@ export const useUpdateLoopStore = defineStore('UpdateLoop', () => {
|
||||
nextDiscordUpdate,
|
||||
ipcTimeout,
|
||||
updateLoop,
|
||||
setNextDiscordUpdate,
|
||||
setNextGroupInstanceRefresh,
|
||||
setNextClearVRCXCacheCheck
|
||||
};
|
||||
|
||||
@@ -1980,6 +1980,13 @@ export const useUserStore = defineStore('User', () => {
|
||||
userDialog.value.memo = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
*/
|
||||
function setCurrentUserColour(value) {
|
||||
currentUser.value.$userColour = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -2026,6 +2033,7 @@ export const useUserStore = defineStore('User', () => {
|
||||
handleConfig,
|
||||
showSendBoopDialog,
|
||||
setUserDialogMemo,
|
||||
setCurrentUserColour,
|
||||
checkNote,
|
||||
toggleSharedConnectionsOptOut,
|
||||
toggleDiscordFriendsOptOut
|
||||
|
||||
@@ -240,6 +240,13 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
proxyServer.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {boolean} value
|
||||
*/
|
||||
function setIpcEnabled(value) {
|
||||
ipcEnabled.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@@ -870,6 +877,7 @@ export const useVrcxStore = defineStore('Vrcx', () => {
|
||||
appStartAt,
|
||||
proxyServer,
|
||||
setProxyServer,
|
||||
setIpcEnabled,
|
||||
currentlyDroppingFile,
|
||||
isRegistryBackupDialogVisible,
|
||||
ipcEnabled,
|
||||
|
||||
Reference in New Issue
Block a user