Skip to content

[Bug] Grid row selection is not cleared after a batch edit (data objects and assets) - #4256

Merged
ValeriaMaltseva merged 3 commits into
2026.3from
fix/pv565-clear-selection-after-batch-edit
Oct 23, 2026
Merged

ValeriaMaltseva merged 3 commits into
2026.3from
fix/pv565-clear-selection-after-batch-edit

Conversation

@ValeriaMaltseva

@ValeriaMaltseva ValeriaMaltseva commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Changes in this pull request

Resolves pimcore/platform-version#565

After a batch edit in a data object or asset folder listing, the edited rows stayed selected, so they easily ended up in the next batch operation. Only batch delete cleared the selection.

  • RowSelectionProvider gets deselectRows(ids), a functional state update that removes only the given ids from the latest selection. This is an additive field on the SDK-exported RowSelectionData; setSelectedRows is unchanged.
  • Multi-row batch edit (DataObjectBatchEditJob, AssetBatchEditJob): pass onFinish: async () => { deselectRows(selectedRowsIds) }, using the ids submitted to that job. The window modal doesn't block the grid, so rows selected while the job runs stay selected. Clearing the whole selection could have turned the next batch edit into a folder-wide one.
  • Single-row patch: on success, deselect the submitted row (response.error === undefined). For data objects, the grid invalidation moved from an effect gated on selectedRowsCount === 1 to right after the successful patch, so deselecting can't skip it.
  • AbstractBatchEditJobOptions.onFinish is widened to () => void | Promise<void>, so the modals can pass plain callbacks (Sonar S7503). handleCompletion() already awaits it, so existing async callers keep working.
  • Folder-wide batch edit (no selection) is unchanged.
  • data-object/.../batch-edit-modal.tsx was already at 299 lines on 2026.3, so I added a file-level /* eslint-disable max-lines */, the same as tags.ts and install-core-services.ts, instead of reformatting unrelated code.

Additional info

Verified locally:

  • ESLint on the changed files.
  • tsc --noEmit reports no errors in the touched code.
  • New row-selection-provider.test.tsx (3 tests), including the case where the selection changes before the job completes.
  • execution-engine and element listing jest suites pass (167 tests).

Not verified: the modal wiring has no automated test, because rendering the modals in jest is blocked by the @sdk/components → antd ESM import. Not exercised in a running Studio.

Manual test, in a data object folder grid and an asset folder grid:

  1. Select 2 or more rows, run a batch edit, wait for the job to finish: those rows are deselected.
  2. Select rows A and B, start a batch edit, then select C while the job runs: after it finishes, only C stays selected.
  3. Select exactly 1 row and run a batch edit: it's deselected and the grid shows the new value.
  4. Make a failing single-row asset edit: the selection should stay.

🤖 Generated with Claude Code

The multi-row batch edit jobs for data objects and assets now get an
onFinish callback that clears the selection, and the single-row patch
path clears it on success. Previously the edited rows stayed selected
and easily slipped into the next batch operation.

Resolves pimcore/platform-version#565

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 22, 2026 16:19
@ValeriaMaltseva ValeriaMaltseva added this to the 2026.3.4 milestone Oct 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Delayed selection resets can erase newer selections and unintentionally change a pending batch edit to folder-wide scope.

1 open issue
What changed in this PR

Verdict: Needs changes. This PR addresses stale row selections after batch edits in asset and data-object listings.

Changes:

  • Adds selection resets to multi-row job completion callbacks.
  • Clears selection after successful single-row requests, preserving the data-object invalidation order.
  • Adds a file-level max-lines exemption to the data-object modal.

The changes address missing cleanup, but asynchronous selection handling still needs correction. Both listing types are covered; the shared selection provider is the appropriate boundary for an atomic update. No public API signatures change.

No regression tests or documentation changes are included. A focused selection-lifecycle test is needed; running-Studio behavior and partial-failure completion remain unverified.

File Description
assets/​js/​src/​core/​modules/​data-object/​listing/​batch-actions/​batch-edit-modal/​batch-edit-modal.tsx Adds single-row and background-job selection cleanup, plus a lint exemption.
assets/​js/​src/​core/​modules/​asset/​listing/​batch-actions/​batch-edit-modal/​batch-edit-modal.tsx Adds selection cleanup after successful requests and background jobs.

Review effort: Balanced

Batch edit jobs finish in the background while the window modal leaves
the grid usable, so clearing the whole selection on completion could
erase rows selected in the meantime and turn the next batch edit into a
folder-wide one. The row-selection provider now exposes deselectRows(ids),
a functional update that removes only the given ids, and both batch edit
modals use it with the ids they submitted.

The data-object single-row path invalidates the grid right after a
successful patch instead of in an effect gated on the selection count.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ValeriaMaltseva
ValeriaMaltseva requested a balanced review from Copilot October 22, 2026 17:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Asynchronous modal integration and live-grid behavior still need verification before approval.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Typing onFinish as () => Promise<void> forced the batch edit modals to
pass async callbacks with nothing to await (Sonar S7503). handleCompletion
already awaits the callback, so widening the option to
() => void | Promise<void> keeps existing async callers working and
matches the ownership and recycle-bin jobs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The required deselectRows field breaks compatibility with existing SDK extensions that supply the previous context shape.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Preserve backward compatibility for the row selection context API

assets/​js/​src/​core/​modules/​element/​listing/​decorators/​row-selection/​context-layer/​provider/​row-selection-provider.tsx:22

Adding a required member breaks the public SDK context contract: RowSelectionData and RowSelectionContext are exported from assets/js/src/sdk/modules/element/index.ts:326. An extension providing the previous four-field context value will no longer type-check. Keep the previous context shape accepted and expose the new capability through a backward-compatible extension, adapting consumers without losing the atomic selection update. Reserve a required member for a major API change; simply making it optional is insufficient while the modals call it unconditionally.

Review effort: Balanced

@ValeriaMaltseva
ValeriaMaltseva merged commit 00031a3 into 2026.3 Oct 23, 2026
23 of 24 checks passed
@ValeriaMaltseva
ValeriaMaltseva deleted the fix/pv565-clear-selection-after-batch-edit branch October 23, 2026 09:41
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 23, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants