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