Skip to content

Commit e2bdc83

Browse files
committed
Don't wait to return empty
1 parent 06ffa2b commit e2bdc83

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎src/Database/Database.php‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4275,6 +4275,9 @@ public function updateDocument(string $collection, string $id, Document $documen
42754275
$old = Authorization::skip(fn () => $this->silent(
42764276
fn () => $this->getDocument($collection->getId(), $id, forUpdate: true)
42774277
));
4278+
if ($old->isEmpty()) {
4279+
return new Document();
4280+
}
42784281

42794282
$skipPermissionsUpdate = true;
42804283

@@ -4414,10 +4417,6 @@ public function updateDocument(string $collection, string $id, Document $documen
44144417
}
44154418
}
44164419

4417-
if ($old->isEmpty()) {
4418-
return new Document();
4419-
}
4420-
44214420
if ($shouldUpdate) {
44224421
$document->setAttribute('$updatedAt', ($newUpdatedAt === null || !$this->preserveDates) ? $time : $newUpdatedAt);
44234422
}

0 commit comments

Comments
 (0)