Skip to content

Commit

Permalink
fix: prevent action override content on optimizacion
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfran committed Dec 4, 2024
1 parent e033988 commit 9871e30
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions libs/board-commons/src/lib/state-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,23 @@ export function optimize(actions: StateActions[] | unknown[]) {
if (!optimizedTmp[key]) {
optimizedTmp[key] = action;
} else {
optimizedTmp[key] = {
...optimizedTmp[key],
...action,
};
if (action.op === 'remove') {
optimizedTmp[key] = {
...optimizedTmp[key],
...action,
};
} else {
optimizedTmp[key] = {
...optimizedTmp[key],
data: {
...optimizedTmp[key].data,
content: {
...optimizedTmp[key].data.content,
...action.data.content,
},
},
};
}
}
});

Expand Down

0 comments on commit 9871e30

Please sign in to comment.