Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix(web): bind memory message switch state to the message (#21752)

chanxd32e2e85c369
diff --git a/web/src/pages/memory/memory-message/message-table.tsx b/web/src/pages/memory/memory-message/message-table.tsx
index 990c9d7bcb..f5004b7b04 100644
--- a/web/src/pages/memory/memory-message/message-table.tsx
+++ b/web/src/pages/memory/memory-message/message-table.tsx
@@ -344,6 +344,13 @@ export function MemoryTable({
const [expanded, setExpanded] = React.useState<ExpandedState>({});
const table = useReactTable({
data: messages,
+ // Use the message id as the row id so a row keeps its identity when
+ // the backend reorders the list (the list is sorted by `valid_at`,
+ // and messages sharing a timestamp can be reordered after an
+ // update). Without it `row.id` falls back to the row index, so React
+ // reuses the row components - and their switch state - by position
+ // and the switch would show the state of a different message.
+ getRowId: (row) => String(row.message_id),
columns,
onExpandedChange: setExpanded,
getSubRows: (row) => (row.extract as IMessageInfo[]) || undefined,