document-drive 1.0.0-experimental.15 → 1.0.0-experimental.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "document-drive",
3
- "version": "1.0.0-experimental.15",
3
+ "version": "1.0.0-experimental.16",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "module": "./src/index.ts",
@@ -720,6 +720,10 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
720
720
  private _buildDocument<T extends Document>(
721
721
  documentStorage: DocumentStorage<T>, options?: GetDocumentOptions
722
722
  ): T {
723
+ if (documentStorage.state && (!options || options.checkHashes === false)) {
724
+ return documentStorage as T;
725
+ }
726
+
723
727
  const documentModel = this._getDocumentModel(
724
728
  documentStorage.documentType
725
729
  );
@@ -730,10 +734,6 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
730
734
  ) : documentStorage.operations;
731
735
  const operations = baseUtils.documentHelpers.garbageCollectDocumentOperations(revisionOperations);
732
736
 
733
- if (documentStorage.state && (!options || options.checkHashes === false)) {
734
- return documentStorage as T;
735
- }
736
-
737
737
  return baseUtils.replayDocument(
738
738
  documentStorage.initialState,
739
739
  operations,
@@ -741,7 +741,7 @@ export class DocumentDriveServer extends BaseDocumentDriveServer {
741
741
  undefined,
742
742
  documentStorage,
743
743
  undefined,
744
- { checkHashes: options?.checkHashes ?? true }
744
+ { checkHashes: options?.checkHashes ?? true, reuseOperationResultingState: true }
745
745
  ) as T;
746
746
  }
747
747