#9123 – Fix: Monomers disappearing when expanding/collapsing in Molecules Mode after moving in Macromolecules Mode#9503
Merged
AlexeyGirin merged 1 commit intomasterfrom Mar 31, 2026
Conversation
rrodionov91
approved these changes
Mar 31, 2026
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?
Fixed a crash that caused monomer structures to disappear when trying to expand/collapse them in Molecules Mode after moving or selecting them in Macromolecules Mode.
Root cause:
Redux Toolkit uses Immer, which recursively freezes all objects placed into Redux state. When
loadMonomerLibraryis dispatched, library items (and all their nested objects) become frozen. These frozen objects were then assigned directly toBaseMonomer.monomerItemviaupdateMonomerItem. When the user switched to Molecules Mode and tried to expand/collapse a monomer, writing tomonomerItem.expandedthrew:Changes made:
DrawingEntitiesManager.ts(updateMonomerItem) — Primary fixinitialMonomer.monomerItem = monomerItemNew;Object.isFrozen(monomerItemNew)and creates a shallow copy if frozen before assigningSGroupAttr.ts(execute) — Defensive fix at crash sitesgroup.monomer.monomerItem.expanded = this.data.valuemonomerItemis frozen and thaws it with a shallow copy before writingmonomerItemin memoryoperations/sgroup/index.ts(SGroupAdd.execute) — Same defensive fixSGroupAddpath which also writesmonomerItem.expandedCheck list
#1234 – issue name