Skip to content

Commit

Permalink
Check for existing patches on state import (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
rihardsgravis authored Jan 22, 2021
1 parent 60ef1b5 commit b55ae35
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions core/src/state/patches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,16 @@ class Patches {
}

public import($patches: Patch[]) {
const state = this.state;

this.patches.set(
$patches.map(($patch) => {
const $exists = state.find((item) => item.input === $patch.input && item.output === $patch.output);

if ($exists) {
return $exists;
}

if (!$patch.color) {
$patch.color = randomColor();
}
Expand Down

1 comment on commit b55ae35

@vercel
Copy link

@vercel vercel bot commented on b55ae35 Jan 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.