Open
Description
Currently the actions are changing the chart object.
From my experience in react it's better to clone the state object than change the object itself for various reasons (for react to know when to update the DOM without deep comparison with previous state)
For example: in actions.ts:
if (chart.selected.id !== nodeId || chart.selected.type !== 'node') {
chart.selected = {
type: 'node',
id: nodeId,
}
}
return chart
Would be immutable as:
if (chart.selected.id !== nodeId || chart.selected.type !== "node") {
return {
...chart,
selected: {
type: "node",
id: nodeId
}
};
}
else return chart;
@MrBlenny What do you think?
Metadata
Assignees
Labels
No labels
Activity