Skip to content

Commit ad75496

Browse files
committed
fix(sketcher): fix some sketcher issues caused by multiple sketchers being open
for this the delete button that is part of the button group was removed
1 parent 582ca3c commit ad75496

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

components/SMILESInput.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,15 @@ export const SMILESInput = ({
119119
return (
120120
<Box display="flex" flexDirection="column" gap={1} width={width}>
121121
<Box height={height}>
122-
<Sketcher smiles={smiles} onUnmount={() => setIsASketcherOpen(false)} />
122+
<Sketcher smiles={smiles} />
123123
</Box>
124124
<ButtonGroup size="small" sx={{ alignSelf: "end" }} variant="outlined">
125-
<Button
126-
color="warning"
127-
onClick={() => {
128-
onDelete && onDelete();
129-
onClose && onClose();
130-
}}
131-
>
132-
Delete
133-
</Button>
134125
<Button
135126
color="info"
136127
onClick={() => {
137128
setMode("smiles");
138129
onClose && onClose();
130+
setIsASketcherOpen(false);
139131
}}
140132
>
141133
Cancel
@@ -150,6 +142,7 @@ export const SMILESInput = ({
150142
setMode("smiles");
151143
onSave(smi);
152144
onClose && onClose();
145+
setIsASketcherOpen(false);
153146
} else {
154147
enqueueError("Smiles not obtained");
155148
}

components/Sketcher.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import "ketcher-react/dist/index.css";
1111

1212
export interface SketcherProps {
1313
smiles: string;
14-
onUnmount?: () => void;
1514
}
1615

1716
export const allButtons = {
@@ -76,21 +75,14 @@ export const allButtons = {
7675
"enhanced-stereo": false,
7776
};
7877

79-
export const Sketcher = ({ smiles, onUnmount }: SketcherProps) => {
78+
export const Sketcher = ({ smiles }: SketcherProps) => {
8079
const { enqueueError } = useEnqueueError();
8180

8281
// Synchronise the react state to the component
8382
useEffect(() => {
8483
global.ketcher?.setMolecule(smiles);
8584
}, [smiles]);
8685

87-
useEffect(() => {
88-
// do nothing on mount
89-
return () => {
90-
onUnmount && onUnmount();
91-
};
92-
});
93-
9486
return (
9587
<Editor
9688
buttons={Object.fromEntries(

0 commit comments

Comments
 (0)