fix feed collapsing due to unstable row IDs

This commit is contained in:
pa
2026-02-08 22:35:17 +09:00
parent 980b2b7e12
commit 1751929f87

View File

@@ -77,13 +77,26 @@
feedTable.value.pageSizeLinked ? appearanceSettingsStore.tablePageSize : feedTable.value.pageSize feedTable.value.pageSizeLinked ? appearanceSettingsStore.tablePageSize : feedTable.value.pageSize
); );
function getFeedRowId(row) {
if (row?.id != null) return `id:${row.id}`;
if (row?.rowId != null) return `row:${row.rowId}`;
const type = row?.type ?? '';
const createdAt = row?.created_at ?? row?.createdAt ?? '';
const userId = row?.userId ?? row?.senderUserId ?? '';
const location = row?.location ?? row?.details?.location ?? '';
const message = row?.message ?? '';
return `${type}:${createdAt}:${userId}:${location}:${message}`;
}
const { table, pagination } = useVrcxVueTable({ const { table, pagination } = useVrcxVueTable({
get data() { get data() {
return feedTableData.value; return feedTableData.value;
}, },
persistKey: 'feed', persistKey: 'feed',
columns: baseColumns, columns: baseColumns,
getRowId: (row, index) => `${row.type}:${row.created_at ?? ''}:${row.rowId ?? index}`, getRowId: getFeedRowId,
enableExpanded: true, enableExpanded: true,
getRowCanExpand: () => true, getRowCanExpand: () => true,
initialSorting: [], initialSorting: [],
@@ -91,6 +104,9 @@
initialPagination: { initialPagination: {
pageIndex: 0, pageIndex: 0,
pageSize: pageSize.value pageSize: pageSize.value
},
tableOptions: {
autoResetExpanded: false
} }
}); });