This commit is contained in:
Jan Prochazka
2020-12-26 16:07:23 +01:00
parent e8ffaaab6f
commit 96a52750e2
2 changed files with 16 additions and 10 deletions

View File

@@ -49,22 +49,26 @@ export default function Designer({ value, onChange }) {
const bringToFront = React.useCallback(
(table) => {
onChange((current) => ({
...current,
tables: [...(current.tables || []).filter((x) => x.designerId != table.designerId), table],
}));
const newValue = {
...value,
tables: [...(value.tables || []).filter((x) => x.designerId != table.designerId), table],
};
onChange(newValue);
},
[onChange]
[onChange, value]
);
const removeTable = React.useCallback(
(table) => {
onChange((current) => ({
...current,
tables: (current.tables || []).filter((x) => x.designerId != table.designerId),
}));
const newValue = {
...value,
tables: (value.tables || []).filter((x) => x.designerId != table.designerId),
};
onChange(newValue);
},
[onChange]
[onChange, value]
);
return (