Skip to content

Commit

Permalink
use set to de dupe the workbench items in the set method
Browse files Browse the repository at this point in the history
  • Loading branch information
sixlighthouses committed Aug 6, 2023
1 parent 621dc4e commit 6e4394d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/Models/Workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ export default class Workbench {
return this._items.map(dereferenceModel);
}
set items(items: readonly BaseModel[]) {
this._items.spliceWithArray(0, this._items.length, items.slice());
const setItems = new Set(items);
this._items.spliceWithArray(
0,
this._items.length,
Array.from(setItems).slice()
);
}

/**
Expand Down

0 comments on commit 6e4394d

Please sign in to comment.