diff --git a/Sources/Document/CRDT/CRDTTree.swift b/Sources/Document/CRDT/CRDTTree.swift index ce24ba53..07dedeb9 100644 --- a/Sources/Document/CRDT/CRDTTree.swift +++ b/Sources/Document/CRDT/CRDTTree.swift @@ -1130,7 +1130,7 @@ class CRDTTree: CRDTGCElement { } } } - return changes + return changes.reversed() } /** diff --git a/Tests/Integration/TreeIntegrationTests.swift b/Tests/Integration/TreeIntegrationTests.swift index c144bc32..99be4abe 100644 --- a/Tests/Integration/TreeIntegrationTests.swift +++ b/Tests/Integration/TreeIntegrationTests.swift @@ -3598,8 +3598,8 @@ final class TreeIntegrationTreeChangeGeneration: XCTestCase { [TreeEditOpInfoForDebug(from: 1, to: 3, value: nil, fromPath: nil, toPath: nil), TreeEditOpInfoForDebug(from: 1, to: 1, value: [JSONTreeTextNode(value: "c")], fromPath: nil, toPath: nil)], [TreeEditOpInfoForDebug(from: 2, to: 2, value: [JSONTreeTextNode(value: "c")], fromPath: nil, toPath: nil), - TreeEditOpInfoForDebug(from: 1, to: 2, value: [], fromPath: nil, toPath: nil), - TreeEditOpInfoForDebug(from: 3, to: 4, value: [], fromPath: nil, toPath: nil)]) + TreeEditOpInfoForDebug(from: 3, to: 4, value: [], fromPath: nil, toPath: nil), + TreeEditOpInfoForDebug(from: 1, to: 2, value: [], fromPath: nil, toPath: nil)]) try await d1.update { root, _ in try (root.t as? JSONTree)?.edit(1, 3) }