Execute ketcher.editor.subscribe("change", () => console.log("hello")); in the console (or add any other change subscription)
In the canvas, add a functional group such as "CF3"
Click on another atom such as "Br" and click on the functional group
Exceptions are thrown and the canvas becomes blank
Actual behavior
After a ketcher editor subscription is added for a "change" event, trying to replace a functional group, expand a functional group, or contract a functional group causes exceptions to be thrown. In addition, the ketcher canvas becomes blank.
This is the stracktrace shown for the exception:
Uncaught TypeError: Cannot read properties of undefined (reading 'type')
at eval (index.modern.js:17491:16)
at Array.forEach (<anonymous>)
at customOnChangeHandler (index.modern.js:17489:31)
at subscribeFuncWrapper (index.modern.js:24527:22)
at Subscription.dispatch (index.js:51:19)
at Editor.update (index.modern.js:24463:29)
at AtomTool.mouseup (index.modern.js:16678:14)
at useToolIfNeeded (index.modern.js:24661:130)
at Handler.eval [as f] (index.modern.js:24721:24)
at DOMSubscription.dispatch (index.js:93:21)
at HTMLDocument.eval (index.modern.js:24708:21)
at HTMLDocument.sentryWrapped (helpers.js:106:17)
Expected behavior
The correct functional group modification on the canvas structure - in this case the "Br" atom replacing the "CF3" functional group.
Steps to Reproduce
ketcher.editor.subscribe("change", () => console.log("hello"));
in the console (or add any other change subscription)Actual behavior After a ketcher editor subscription is added for a "change" event, trying to replace a functional group, expand a functional group, or contract a functional group causes exceptions to be thrown. In addition, the ketcher canvas becomes blank. This is the stracktrace shown for the exception:
Expected behavior The correct functional group modification on the canvas structure - in this case the "Br" atom replacing the "CF3" functional group.
Screenshots https://github.com/user-attachments/assets/ebccc96a-eb12-4d08-88c0-c0402fb0552c
Desktop (please complete the following information):
Ketcher version v2.25.0