Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception when modifying a functional group after adding a ketcher editor subscription #5988

Closed
Tracked by #6601
askyel opened this issue Nov 18, 2024 · 2 comments · Fixed by #5993
Closed
Tracked by #6601
Assignees
Labels
Micromolecules canvas Bucket: Micromolecules canvas related issues User`s Feedback

Comments

@askyel
Copy link
Contributor

askyel commented Nov 18, 2024

Steps to Reproduce

  1. Go to https://lifescience.opensource.epam.com/KetcherDemoSA/index.html or use ketcher v.2.25.0
  2. Execute ketcher.editor.subscribe("change", () => console.log("hello")); in the console (or add any other change subscription)
  3. In the canvas, add a functional group such as "CF3"
  4. Click on another atom such as "Br" and click on the functional group
  5. 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.

Screenshots
https://github.com/user-attachments/assets/ebccc96a-eb12-4d08-88c0-c0402fb0552c
image

Desktop (please complete the following information):

  • OS: macOS
  • Browser: chrome
  • Version: 130.0.6723.117 (Official Build) (arm64)

Ketcher version
v2.25.0

@rrodionov91
Copy link
Collaborator

Hi @askyel
Thank you for highlighting this issue.
We will check it out.

askyel added a commit to inductive-bio/ketcher that referenced this issue Nov 19, 2024
@rrodionov91 rrodionov91 moved this to Code review in Ketcher Nov 19, 2024
@rrodionov91 rrodionov91 self-assigned this Nov 20, 2024
askyel added a commit to inductive-bio/ketcher that referenced this issue Nov 22, 2024
@github-project-automation github-project-automation bot moved this from Code review to Ready for testing in Ketcher Nov 29, 2024
@Zhirnoff Zhirnoff moved this from Ready for testing to In testing in Ketcher Dec 4, 2024
@Zhirnoff
Copy link
Collaborator

Zhirnoff commented Dec 4, 2024

Tested. Bug fixed.

2024-12-04_17h57_10.mp4

Desktop:

  • OS: Windows 11
  • Browser Chrome
  • Version 128.0.6613.120 (Official Build) (64-bit)

Ketcher version
[Version 2.28.0-rc.1]
Indigo version
[Version 1.27.0-rc.1]

@Zhirnoff Zhirnoff moved this from In testing to Done in Ketcher Dec 4, 2024
@AlexeyGirin AlexeyGirin added the Micromolecules canvas Bucket: Micromolecules canvas related issues label Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Micromolecules canvas Bucket: Micromolecules canvas related issues User`s Feedback
Projects
Status: Done
4 participants