Skip to content

fix(edit-content): preserve pagination on row reorder in relationship field#35286

Merged
oidacra merged 3 commits intomainfrom
issue-35106-fix-reorder-pagination-reset-in-relationship-field
Apr 10, 2026
Merged

fix(edit-content): preserve pagination on row reorder in relationship field#35286
oidacra merged 3 commits intomainfrom
issue-35106-fix-reorder-pagination-reset-in-relationship-field

Conversation

@oidacra
Copy link
Copy Markdown
Member

@oidacra oidacra commented Apr 10, 2026

Summary

  • Fixed drag-and-drop row reorder in paginated relationship fields resetting to page 1
  • Root cause: onRowReorder called setData() which unconditionally resets pagination offset and currentPage to 0/1
  • Added reorderData() store method that updates the data array without touching pagination state

Closes #35106

Changes

File Change
core-web/.../store/relationship-field.store.ts Added reorderData() method that patches data without resetting pagination
core-web/.../dot-relationship-field.component.ts Changed onRowReorder to call reorderData() instead of setData()
core-web/.../store/relationship-field.store.spec.ts Added tests for reorderData() preserving pagination on page 1 and page 2+
core-web/.../dot-edit-content-relationship-field.component.spec.ts Updated reorder tests to verify reorderData() is called

Acceptance Criteria

  • When the user drags and drops a row to reorder on any paginated page other than page 1, the table remains on the same page after the reorder completes (pagination offset and currentPage are preserved)
  • When the user drags and drops a row to reorder on page 1 of a paginated relationship field, the table remains on page 1 (no regression from current behavior)
  • After a successful reorder on a non-first page, the page indicator still displays the correct current page number
  • After a successful reorder on a non-first page, the items displayed are still the correct items for that page
  • Adding new items via the "Existing Content" or "New Content" dialogs still resets pagination to page 1 (existing setData behavior preserved)
  • Deleting an item on the last page that causes the page to become empty still falls back to the previous valid page (existing deleteItem logic preserved)

Test Plan

  • Create a Content Type with a Relationship field (Many-to-Many)
  • Create an entry and add 13+ items to the relationship field (triggers 3 pages)
  • Navigate to page 2 or 3
  • Drag and drop to reorder items — verify you stay on the same page
  • Navigate to page 1 and reorder — verify no regression
  • Add new items via "Existing Content" dialog — verify pagination resets to page 1
  • Delete items on the last page until the page becomes empty — verify fallback to previous page

Visual Changes

CleanShot.2026-04-10.at.12.28.35.mp4

This PR fixes: #35106

… field

Drag-and-drop reorder on paginated relationship fields was resetting to
page 1 because onRowReorder called setData(), which unconditionally
resets pagination. Added reorderData() store method that updates data
without touching pagination state.

Closes #35106
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 10, 2026

Claude finished @oidacra's task in 3m 10s —— View job


Claude finished @oidacra's task in 1m 52s —— View job


I'll analyze this and get back to you.

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 10, 2026

Rollback Safety Analysis complete. Label AI: Safe To Rollback has been applied. This PR is frontend-only (Angular/TypeScript store method addition + component + tests) with no DB, ES, REST API, or backend changes. No unsafe categories match.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes relationship-field row drag-and-drop reordering so pagination state (offset/currentPage) is preserved instead of resetting back to page 1, aligning reorder behavior with the existing paginated data rendering approach.

Changes:

  • Added a reorderData() store method to update the backing data array without resetting pagination.
  • Updated onRowReorder to use reorderData() (instead of setData()), preserving the current page after a reorder.
  • Added/updated unit tests around reorderData() and the reorder call site.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/store/relationship-field.store.ts Adds reorderData() to patch data without touching pagination state.
core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/components/dot-relationship-field/dot-relationship-field.component.ts Switches reorder persistence from setData() to reorderData() in onRowReorder.
core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/store/relationship-field.store.spec.ts Adds unit coverage ensuring reorderData() preserves pagination state.
core-web/libs/edit-content/src/lib/fields/dot-edit-content-relationship-field/dot-edit-content-relationship-field.component.spec.ts Updates reorder-related expectations to reference reorderData().

oidacra added 2 commits April 10, 2026 12:42
Fix and re-enable the xdescribe'd component tests:
- Add missing DotEditContentStore mock provider
- Add async/await to showCreateNewContentDialog tests
@oidacra oidacra enabled auto-merge April 10, 2026 16:54
@oidacra oidacra added this pull request to the merge queue Apr 10, 2026
Merged via the queue into main with commit dac0b3a Apr 10, 2026
28 checks passed
@oidacra oidacra deleted the issue-35106-fix-reorder-pagination-reset-in-relationship-field branch April 10, 2026 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Pagination in relationship field does not change displayed items

3 participants