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

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

askyel
Copy link

@askyel askyel commented Nov 19, 2024

How the feature works? / How did you fix the issue?

(Screenshots, videos, or GIFs, if applicable)
In issue #5988, the structure in the canvas disappeared when the editor was configured with a custom change subscription and a functional group was replaced with a different atom.
The error thrown is that the _inverted field on the s-group attribute operations are undefined, but assumed to be defined here:


An operation's _inverted field is only set after the perform function is executed here:
perform(restruct: ReStruct): BaseOperation {
this.execute(restruct);
if (!this._inverted) {
this._inverted = this.invert();
this._inverted._inverted = this;
}
return this._inverted;
}

The change in this PR moves the perform function execution from before the s-group attribute operations were added to after, such that those operations also have their _inverted field set.
I tested the same behavior as in the issue locally and this change solves the issue:
https://github.com/user-attachments/assets/8b9764a3-1074-40de-a821-9e44cb16a9d9

Note that the _inverted field still can be undefined in the customOnChangeHandler for other operations and this PR does not address that issue.

Check list

  • unit-tests written
  • e2e-tests written
  • documentation updated
  • PR name follows the pattern #1234 – issue name
  • branch name doesn't contain '#'
  • PR is linked with the issue
  • base branch (master or release/xx) is correct
  • task status changed to "Code review"
  • reviewers are notified about the pull request

@askyel askyel changed the title 5988 - perform s-group attribute action when an s-group is deleted 5988 - Exception when modifying a functional group after adding a ketcher editor subscription Nov 19, 2024
@askyel askyel changed the title 5988 - Exception when modifying a functional group after adding a ketcher editor subscription #5988 - Exception when modifying a functional group after adding a ketcher editor subscription Nov 19, 2024
@askyel askyel marked this pull request as ready for review November 19, 2024 22:06
@rrodionov91
Copy link
Collaborator

Dear @askyel
May I ask you to rebase from latest master please? It should fix failed tests.

@askyel askyel force-pushed the 5988-func-group-subscription-issue branch from b63cf63 to 2136f3a Compare November 22, 2024 14:00
@askyel
Copy link
Author

askyel commented Nov 22, 2024

Dear @askyel May I ask you to rebase from latest master please? It should fix failed tests.

Yes, it should be updated now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception when modifying a functional group after adding a ketcher editor subscription
2 participants