Skip to content

Commit 1495034

Browse files
committed
fix(sync): reply to queries with steps since last save
This was a very inefficient attempt to resync that we did not even process on the client side. Only the steps since the last save may not be enough to get back in sync. However we can expand this by including the document state or storing it as the first step after a save. Signed-off-by: Max <max@nextcloud.com>
1 parent e9919d3 commit 1495034

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/Service/DocumentService.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,10 @@ public function addStep(Document $document, Session $session, array $steps, int
228228
}
229229
$newVersion = $this->insertSteps($document, $session, $stepsToInsert);
230230
}
231-
// If there were any queries in the steps send the entire history
232-
$getStepsSinceVersion = count($querySteps) > 0 ? 0 : $version;
231+
// If there were any queries in the steps send all steps since last save.
232+
$getStepsSinceVersion = count($querySteps) > 0
233+
? $document->getLastSavedVersion()
234+
: $version;
233235
$allSteps = $this->getSteps($documentId, $getStepsSinceVersion);
234236
$stepsToReturn = [];
235237
foreach ($allSteps as $step) {

0 commit comments

Comments
 (0)