Skip to content

Commit

Permalink
Merge pull request #197 from rimbu-org/fix/fix-table-builder-mofidyat
Browse files Browse the repository at this point in the history
fix(table): modifyAt did not correctly remove reference to immutable instance on change
  • Loading branch information
vitoke authored Dec 25, 2023
2 parents 8acb80f + c333cd0 commit 5ae5daf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions deno_dist/table/custom/implementation/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,10 @@ export class TableBuilder<
},
});

if (changed) {
this.source = undefined;
}

return changed;
};

Expand Down
4 changes: 4 additions & 0 deletions packages/table/src/custom/implementation/base.mts
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,10 @@ export class TableBuilder<
},
});

if (changed) {
this.source = undefined;
}

return changed;
};

Expand Down
1 change: 1 addition & 0 deletions packages/table/test-utils/table-standard-test.mts
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,7 @@ export function runTableTestsWith(
expect(b.modifyAt(1, 'a', { ifExists: () => true })).toBe(false);
expect(b.modifyAt(1, 'a', { ifExists: () => false })).toBe(true);
expect(b.modifyAt(1, 'b', { ifNew: true })).toBe(true);
expect(b.get(1, 'b')).toBe(true);
expect(b.modifyAt(1, 'b', { ifExists: () => true })).toBe(false);
expect(b.modifyAt(1, 'b', { ifExists: () => false })).toBe(true);
expect(b.modifyAt(10, 'a', { ifNew: (none) => none })).toBe(false);
Expand Down

0 comments on commit 5ae5daf

Please sign in to comment.