Skip to content

fix(amis-core): restore list order on drag reset - #21517

Open
dvd233 wants to merge 1 commit into
baidu:masterfrom
dvd233:codex/contrib-amis-cards-reset-12202
Open

dvd233 wants to merge 1 commit into
baidu:masterfrom
dvd233:codex/contrib-amis-cards-reset-12202

Conversation

@dvd233

@dvd233 dvd233 commented Sep 13, 2026

Copy link
Copy Markdown

Description

Restore the original item order when ListStore.reset() cancels a drag.

Cards.exchange() changes the observable items array, while reset() only
restored each item's data and newIndex. As a result, cancelling a drag left
Cards rendered in the exchanged order.

The fix sorts the existing item nodes by their immutable initialization index
before resetting each item. Normal updates and server-provided ordering are
unchanged.

Verification

  • Focused ListStore regression test: 1/1 passed with the repository canvas mock preload
  • git diff --check passed

Fixes #12202

@github-actions github-actions Bot added the fix label Sep 13, 2026
@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.

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】Cards拖拽排序,取消排序后,无法重置数据

1 participant