Skip to content

Commit

Permalink
Rollback edits in reverse
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelCourtney committed Jan 24, 2025
1 parent ea5a811 commit c805d3e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public void run(@NotNull final EditablePlan plan) {
Map.of("biteSize", SerializedValue.of(2))
);

plan.commit();

if (whichToDelete >= 0) {
plan.delete(ids[whichToDelete], anchorStrategy);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class DefaultEditablePlanDriver(

val result = uncommittedChanges
uncommittedChanges = mutableListOf()
for (edit in result) {
for (edit in result.reversed()) {
when (edit) {
is Edit.Create -> adapter.delete(edit.directive.id)
is Edit.Delete -> adapter.create(edit.directive)
Expand Down

0 comments on commit c805d3e

Please sign in to comment.