Sync L0 cleanup on delete and swipe
This commit is contained in:
@@ -83,6 +83,9 @@ import {
|
||||
getStateAtomsCount,
|
||||
getStateVectorsCount,
|
||||
saveStateVectors,
|
||||
deleteStateAtomsFromFloor,
|
||||
deleteStateVectorsFromFloor,
|
||||
deleteL0IndexFromFloor,
|
||||
} from "./vector/storage/state-store.js";
|
||||
|
||||
// vector io
|
||||
@@ -1342,6 +1345,18 @@ async function handleMessageDeleted() {
|
||||
|
||||
await rollbackSummaryIfNeeded();
|
||||
await syncOnMessageDeleted(chatId, newLength);
|
||||
|
||||
// L0 同步:清理 floor >= newLength 的 atoms / index / vectors
|
||||
deleteStateAtomsFromFloor(newLength);
|
||||
deleteL0IndexFromFloor(newLength);
|
||||
if (chatId) {
|
||||
await deleteStateVectorsFromFloor(chatId, newLength);
|
||||
}
|
||||
|
||||
invalidateLexicalIndex();
|
||||
await sendAnchorStatsToFrame();
|
||||
await sendVectorStatsToFrame();
|
||||
|
||||
applyHideStateDebounced();
|
||||
}
|
||||
|
||||
@@ -1350,8 +1365,20 @@ async function handleMessageSwiped() {
|
||||
const lastFloor = (chat?.length || 1) - 1;
|
||||
|
||||
await syncOnMessageSwiped(chatId, lastFloor);
|
||||
|
||||
// L0 同步:清理 swipe 前该楼的 atoms / index / vectors
|
||||
deleteStateAtomsFromFloor(lastFloor);
|
||||
deleteL0IndexFromFloor(lastFloor);
|
||||
if (chatId) {
|
||||
await deleteStateVectorsFromFloor(chatId, lastFloor);
|
||||
}
|
||||
|
||||
invalidateLexicalIndex();
|
||||
|
||||
initButtonsForAll();
|
||||
applyHideStateDebounced();
|
||||
await sendAnchorStatsToFrame();
|
||||
await sendVectorStatsToFrame();
|
||||
}
|
||||
|
||||
async function handleMessageReceived() {
|
||||
|
||||
Reference in New Issue
Block a user