Skip to content

Commit acc752b

Browse files
authored
Fix chat deletion function (#454)
This is effectively a semantic merge conflict between some of Emma's changes and mine. I want to properly delete messages on chat deletion, but in order to fix things, I'm skipping it entirely (deleting the chat itself is fine since all functions try to load the chat first)
1 parent df09dad commit acc752b

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

convex/messages.ts

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -676,23 +676,9 @@ export const removeChatInner = internalMutation({
676676

677677
// This doesn't delete the snapshot, and it also will break if the chat was ever shared.
678678
// We might want soft deletion instead, but for now, let's just delete more stuff.
679-
const storageState = await ctx.db
680-
.query('chatMessagesStorageState')
681-
.withIndex('byChatId', (q) => q.eq('chatId', existing._id))
682-
.unique();
683-
if (storageState === null) {
684-
await ctx.scheduler.runAfter(0, internal.messages.cleanupChatMessages, {
685-
chatId: existing._id,
686-
assertStorageStateExists: false,
687-
});
688-
} else {
689-
if (storageState.storageId !== null) {
690-
await ctx.scheduler.runAfter(0, internal.messages.maybeCleanupStaleChatHistory, {
691-
storageId: storageState.storageId,
692-
});
693-
}
694-
await ctx.db.delete(storageState._id);
695-
}
679+
680+
// TODO(sarah) -- test that this works and is the desired behavior on deletion
681+
// await deletePreviousStorageStates(ctx, { chat: existing });
696682
const convexProject = existing.convexProject;
697683
if (convexProject !== undefined && convexProject.kind === 'connected') {
698684
const credentials = await ctx.db

0 commit comments

Comments
 (0)