#8898 Selection ignored in Ketcher API calls#8901
Merged
Merged
Conversation
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix selection issue in Ketcher API calls
Fix selection ignored in setMolecule and addFragment API calls
Dec 10, 2025
rrodionov91
approved these changes
Dec 12, 2025
AlexeyGirin
added a commit
that referenced
this pull request
Jan 3, 2026
* Initial plan * Add selection restoration for setMolecule and addFragment API methods Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com> * Add unit tests for getSelectionFromStruct function Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com> * Add code comments explaining selection entity types Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com> * Fix unused variable warning in test Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com> * refactor code * refactor: consolidate getSelectionFromStruct and extract selectableEntities * fix: fix import * fix: fix code --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: AlexeyGirin <26869421+AlexeyGirin@users.noreply.github.com> Co-authored-by: KristinaKasyanovskaya <kristina_kasyanovskaya@epam.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
How the feature works? / How did you fix the issue?
Selection data in KET files is preserved through the
initiallySelectedflag on atoms/bonds during deserialization. The UI's "Open as New Project" workflow restores this selection after loading, but the API methods (setMolecule,addFragment) did not.Changes:
getSelectionFromStruct()helper that extracts selection from entities withinitiallySelectedflagssetMolecule()andaddFragment()to restore selection after loading and clean up flagsBefore:
After:
Check list
#1234 – issue nameOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.