Skip to content

fix: preserve condition picker draft when sorting - #21519

Open
Shubham-Padkonde wants to merge 1 commit into
baidu:masterfrom
Shubham-Padkonde:fix/condition-picker-drag-sort
Open

Shubham-Padkonde wants to merge 1 commit into
baidu:masterfrom
Shubham-Padkonde:fix/condition-picker-drag-sort

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Fixes #12216.

With embed: false, the condition builder edits a draft managed by PickerContainer, but drag-and-drop reads this.props.value and calls the final this.props.onChange. Sorting newly added conditions before the first confirmation therefore throws Cannot read properties of undefined (reading 'id'); sorting existing conditions bypasses confirmation and publishes changes even if the dialog is canceled.

Capture the rendered, normalized value and its change callback when dragging starts. Apply the reordered tree through that callback and release the drag context when dragging ends. Embedded mode continues updating immediately.

Three DOM-event regression tests cover sorting a new draft and confirming, canceling/reopening a sorted existing draft, and immediate embedded updates. Before the fix the two popup tests fail and the embedded control passes. Afterward all 16 condition-builder tests pass.

Validation:

  • Full npm run build: passed (Node 26.7.0).
  • npm run typecheck: passed after the build (Node 20.20.2, matching the CI major version).
  • npm test --workspaces -- --runInBand: 1,264 tests passed across the formula, core, UI, and AMIS workspaces (Node 20.20.2). The editor workspaces report no test script implementation.
  • Prettier 2.8.8 applied to the two changed files; git diff --check passed.

The separate office-viewer test suite was not run. This contribution was developed with OpenAI Codex assistance; the reproductions and checks above were executed locally.

Signed-off-by: Shubham Padkonde <shubhampadkonde12@gmail.com>
@github-actions

Copy link
Copy Markdown

👍 Thanks for this!
🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

@github-actions github-actions Bot added the fix label Sep 17, 2026
tomasky added a commit to tomasky/amis that referenced this pull request Sep 27, 2026
- QuickEdit: handleWindowKeyPress 误用包裹元素 tagName 判断,导致快速编辑输入框内空格被拦截
- ListStore.reset: 拖拽后未还原数组顺序,moved 归零但展示顺序仍为拖拽后顺序
- condition-builder: 拖拽读取 props 而非当前草稿 value/onChange,非内嵌 Picker 下排序丢失

同步自社区 PR baidu#21525 / baidu#21517 / baidu#21519

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: conditions组合条件组件,非内嵌模式,脱拽排序报错

1 participant