Skip to content

Commit

Permalink
fix(sync): reply to queries with steps since last save
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
max-nextcloud committed Nov 18, 2024
1 parent 96d7166 commit 9b78b88
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Service/DocumentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,10 @@ public function addStep(Document $document, Session $session, array $steps, int
}
$newVersion = $this->insertSteps($document, $session, $stepsToInsert);
}
// If there were any queries in the steps send the entire history
$getStepsSinceVersion = count($querySteps) > 0 ? 0 : $version;
// If there were any queries in the steps send all steps since last save.
$getStepsSinceVersion = count($querySteps) > 0
? $document->getLastSavedVersion()
: $version;
$allSteps = $this->getSteps($documentId, $getStepsSinceVersion);
$stepsToReturn = [];
foreach ($allSteps as $step) {
Expand Down

0 comments on commit 9b78b88

Please sign in to comment.