mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 06:46:04 +02:00
use shallowReactive for gameLog and feed table data arrays
This commit is contained in:
+5
-4
@@ -1,4 +1,4 @@
|
|||||||
import { ref, watch } from 'vue';
|
import { ref, shallowReactive, watch } from 'vue';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
import { database } from '../service/database';
|
import { database } from '../service/database';
|
||||||
@@ -19,7 +19,7 @@ export const useFeedStore = defineStore('Feed', () => {
|
|||||||
const sharedFeedStore = useSharedFeedStore();
|
const sharedFeedStore = useSharedFeedStore();
|
||||||
|
|
||||||
const feedTable = ref({
|
const feedTable = ref({
|
||||||
data: [],
|
data: shallowReactive([]),
|
||||||
search: '',
|
search: '',
|
||||||
vip: false,
|
vip: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
@@ -46,7 +46,7 @@ export const useFeedStore = defineStore('Feed', () => {
|
|||||||
watch(
|
watch(
|
||||||
() => watchState.isLoggedIn,
|
() => watchState.isLoggedIn,
|
||||||
(isLoggedIn) => {
|
(isLoggedIn) => {
|
||||||
feedTable.value.data = [];
|
feedTable.value.data.length = 0;
|
||||||
feedSessionTable.value = [];
|
feedSessionTable.value = [];
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
initFeedTable();
|
initFeedTable();
|
||||||
@@ -162,11 +162,12 @@ export const useFeedStore = defineStore('Feed', () => {
|
|||||||
if (feedTable.value.vip) {
|
if (feedTable.value.vip) {
|
||||||
vipList = Array.from(friendStore.localFavoriteFriends.values());
|
vipList = Array.from(friendStore.localFavoriteFriends.values());
|
||||||
}
|
}
|
||||||
feedTable.value.data = await database.lookupFeedDatabase(
|
const rows = await database.lookupFeedDatabase(
|
||||||
feedTable.value.search,
|
feedTable.value.search,
|
||||||
feedTable.value.filter,
|
feedTable.value.filter,
|
||||||
vipList
|
vipList
|
||||||
);
|
);
|
||||||
|
feedTable.value.data = shallowReactive(rows);
|
||||||
feedTable.value.loading = false;
|
feedTable.value.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { reactive, ref, watch } from 'vue';
|
import { reactive, ref, shallowReactive, watch } from 'vue';
|
||||||
import { ElMessage, ElMessageBox } from 'element-plus';
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
||||||
import { defineStore } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const gameLogTable = ref({
|
const gameLogTable = ref({
|
||||||
data: [],
|
data: shallowReactive([]),
|
||||||
loading: false,
|
loading: false,
|
||||||
search: '',
|
search: '',
|
||||||
filter: [],
|
filter: [],
|
||||||
@@ -103,7 +103,7 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
|||||||
watch(
|
watch(
|
||||||
() => watchState.isLoggedIn,
|
() => watchState.isLoggedIn,
|
||||||
(isLoggedIn) => {
|
(isLoggedIn) => {
|
||||||
gameLogTable.value.data = [];
|
gameLogTable.value.data.length = 0;
|
||||||
gameLogSessionTable.value = [];
|
gameLogSessionTable.value = [];
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
initGameLogTable();
|
initGameLogTable();
|
||||||
@@ -349,11 +349,12 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
|||||||
if (gameLogTable.value.vip) {
|
if (gameLogTable.value.vip) {
|
||||||
vipList = Array.from(friendStore.localFavoriteFriends.values());
|
vipList = Array.from(friendStore.localFavoriteFriends.values());
|
||||||
}
|
}
|
||||||
gameLogTable.value.data = await database.lookupGameLogDatabase(
|
const rows = await database.lookupGameLogDatabase(
|
||||||
gameLogTable.value.search,
|
gameLogTable.value.search,
|
||||||
gameLogTable.value.filter,
|
gameLogTable.value.filter,
|
||||||
vipList
|
vipList
|
||||||
);
|
);
|
||||||
|
gameLogTable.value.data = shallowReactive(rows);
|
||||||
gameLogTable.value.loading = false;
|
gameLogTable.value.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1434,10 +1435,11 @@ export const useGameLogStore = defineStore('GameLog', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function initGameLogTable() {
|
async function initGameLogTable() {
|
||||||
gameLogTable.value.data = await database.lookupGameLogDatabase(
|
const rows = await database.lookupGameLogDatabase(
|
||||||
gameLogTable.value.search,
|
gameLogTable.value.search,
|
||||||
gameLogTable.value.filter
|
gameLogTable.value.filter
|
||||||
);
|
);
|
||||||
|
gameLogTable.value.data = shallowReactive(rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user