Skip to content

#4009 - Macro: After clicking Cancel, RNA Builder becomes inactive#10397

Open
aslmbk wants to merge 1 commit into
masterfrom
4009-macro-after-clicking-cancel-rna-builder-becomes-inactive
Open

#4009 - Macro: After clicking Cancel, RNA Builder becomes inactive#10397
aslmbk wants to merge 1 commit into
masterfrom
4009-macro-after-clicking-cancel-rna-builder-becomes-inactive

Conversation

@aslmbk

@aslmbk aslmbk commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Closes #4009

Problem

In Macromolecules mode → RNA tab, when building a new preset (adding Sugar/Base)
and pressing Cancel, the RNA Builder ended up inactive: it stayed expanded but
dropped out of edit mode, both action buttons were disabled, and clicking monomers
in the library no longer filled the slots. The user could not start building again
without re-opening the builder.

Root cause

While building a new preset, the in-progress monomers live in component-local state;
the Redux activePreset stays the empty object from createNewPreset. On Cancel,
onCancel called resetRnaBuilder, which sets isEditMode = false. For a new/empty
preset this left the editor expanded but non-editable (handleItemSelection early-returns
when not in edit mode), producing the dead state.

Fix

When Cancel is pressed on a new/never-saved preset (isActivePresetEmpty), reset the
builder to a pristine "new preset" state that stays open and editable — reusing the
same actions as the "New Preset" flow (createNewPreset + setActiveRnaBuilderItem(Presets)

  • setIsEditMode(true)), plus a validations recalculation. Cancelling an edit of an
    existing preset keeps the previous behaviour (revert changes → view mode).

Changes

  • Add resetRnaBuilderToNewPreset helper in resetRnaBuilder.ts.
  • Branch onCancel in RnaEditorExpanded.tsx on the new/empty-preset case.
  • Update RnaEditorExpanded unit test store state.
  • Add Playwright regression test (#4009: RNA Builder stays active after Cancel).

Testing

  • ketcher-macromolecules unit tests: 8 suites / 36 tests / 4 snapshots — passing.
  • tsc --noEmit — clean.
  • Manual: new-preset Cancel keeps builder active and allows building again;
    existing-preset Edit → Cancel still reverts to view mode.

Screenshots

Screen.Recording.2026-07-06.at.13.51.26.mov

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Macro: After clicking Cancel, RNA Builder becomes inactive

1 participant