Skip to content

Commit d1d57d9

Browse files
committed
fix(sync): Cleanup sessions even with unsaved changes
Otherwise the old session would get mixed with the new content when people come back with old state in indexed-db. ( Run playwright/e2e/indexed-db.spec.ts for an example. ) Signed-off-by: Max <[email protected]>
1 parent 1ed464c commit d1d57d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/Listeners/BeforeNodeWrittenListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ public function handle(Event $event): void {
4040
}
4141
// Reset document session to avoid manual conflict resolution if there's no unsaved steps
4242
try {
43-
$this->documentService->resetDocument($node->getId());
43+
$this->documentService->resetDocument($node->getId(), true);
4444
} catch (DocumentHasUnsavedChangesException|NotFoundException $e) {
4545
// Do not throw during event handling in this is expected to happen
4646
// DocumentHasUnsavedChangesException: A document editing session is likely ongoing, someone can resolve the conflict
4747
// NotFoundException: The event was called oin a file that was just created so a NonExistingFile object is used that has no id yet
48-
$this->logger->debug('Reset document skipped in BeforeNodeWrittenEvent', ['exception' => $e]);
48+
$this->logger->warning('Reset document skipped in BeforeNodeWrittenEvent', ['exception' => $e]);
4949
}
5050
}
5151
}

0 commit comments

Comments
 (0)