Skip to content

[BUGFIX][1.2] Fix for moving element - #197

Merged
GSadee merged 3 commits into
Sylius:1.2from
jkindly:bug/fix-moving-elements
Jul 21, 2026
Merged

[BUGFIX][1.2] Fix for moving element#197
GSadee merged 3 commits into
Sylius:1.2from
jkindly:bug/fix-moving-elements

Conversation

@jkindly

@jkindly jkindly commented Jul 17, 2026

Copy link
Copy Markdown
Contributor
Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Related tickets fixes #100, completion of this PR: #159
License MIT

There was 2 bugs (see video).

Bug-Capture-aF9s-8IPDna317y3fe3JbM51kjmGifKiO3w0GohwWQs-.webm
Bug-Capture-G9h7N-adIeRdn-FVFc9nkbAbtD-CIvOUHydfaq-EoSSF.webm

Problem:
Reordering content elements works by swapping values between fixed positions in the collection on the server side, after which the page is refreshed by Symfony UX LiveComponent, which patches the DOM in place.

Whenever the content/type at a given position changed, the morphing tried to turn one element's widget into another's within the same DOM node.

Fix
Append a signature of the element's content to the config container's id. As a result, when the content at a position changes (reorder), the id changes too - LiveComponent replaces the whole subtree instead of morphing it in place - the widget is recreated from the correct, server-rendered value. Works the same for trix and quill, with no JS changes.

@jkindly
jkindly requested a review from a team as a code owner July 17, 2026 06:40
@crydotsnake crydotsnake added Admin Admin Panel related issues and PRs. Bug Confirmed bugs or bugfixes. labels Jul 20, 2026
Comment thread features/admin/page/sorting_content_elements_on_page.feature
Comment thread features/admin/page/sorting_content_elements_on_page.feature
Comment thread features/admin/page/sorting_content_elements_on_page.feature
Comment thread tests/Behat/Context/Ui/Admin/ContentCollectionContext.php
@GSadee
GSadee merged commit 8c39cef into Sylius:1.2 Jul 21, 2026
15 of 22 checks passed
@SzymonFilipek

SzymonFilipek commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

QA results:
Fixes are now checked and moving elements seems to be working fine.

GSadee added a commit that referenced this pull request Jul 22, 2026
| Q               | A
| --------------- | -----
| Bug fix?        | yes
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| Related tickets | completion of
#197
| License         | MIT

A live delete can leave a stray collection entry with an empty type
behind (the DOM row is not always removed before the form is submitted).
Such an entry has no resolvable configuration form, which would raise
"This form should not contain extra fields". Drop these entries before
the collection binds them, so deletion results in the intended, valid
state.

This Pull Request also contains Behat improvements.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Admin Admin Panel related issues and PRs. Bug Confirmed bugs or bugfixes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sorting and ordering is not possible

4 participants