Repository navigation
fix(query-builder): end drag subscriptions on chip drop and destroy - 22.3.x - #18089
Merged
Merged
Conversation
Close the drag ghost mousemove and keyboard subscriptions whenever a drag ends, including drops handled by a target condition, and when the query builder is destroyed. Return false from the drop ghost row check when the drag ghost is gone. Backport of #18041 to 22.3.x.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the query-builder drag-cleanup backport.
No open issues 🎉
What changed in this PR
Backports #18041 to 22.3.x, fixing query-builder drag cleanup to restore application stability and prevent errors when destroyed mid-drag.
Changes:
- Centralizes drag subscription cleanup and adds destruction cleanup.
- Guards against missing drag ghosts and adds five regression tests.
- Documents the fix under version 22.3.3.
| File | Description |
|---|---|
| projects/igniteui-angular/query-builder/src/query-builder/query-builder.component.spec.ts | Adds regression coverage for cleanup, stability, subsequent drags, and missing ghosts. |
| projects/igniteui-angular/query-builder/src/query-builder/query-builder-drag.service.ts | Cleans up subscriptions and the timeout; safely handles missing ghosts. |
| CHANGELOG.md | Records the query-builder fix for 22.3.3. |
Review effort: Balanced
ivanvpetrov
marked this pull request as ready for review
December 3, 2026 10:27
6 of 23 tasks
viktorkombov
approved these changes
Dec 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #17804
Backport of #18041 to 22.3.x.
Description
A condition dropped with the mouse on another condition no longer leaves the drag service listening, so the application becomes stable again. Destroying the query builder while a condition is dragged no longer throws.
resetDragAndDrop(true)now closes the drag ghostmousemovesubscription and the keyboard subscription. It runs at the end of every drag, however it ends: move end, a drop on a condition, a keyboard drop, or a cancel. The four separateunsubscribe()calls it replaces were removed.IgxQueryBuilderDragServiceimplementsngOnDestroy. It closes both subscriptions and clears the pending ghost z-index timeout.dragGhostIsOnDropGhostRow()returnsfalsewhen the drag ghost is gone, instead of throwing.The code is cherry-picked unchanged from #18041. In
CHANGELOG.md, the entry is in a new22.3.3section.Motivation / Context
On release,
igxDragdispatches the drop to the drop area under the pointer before the dragged chip emitsmoveEnd. When that area is another condition's chip (dragDrop) or its wrapper (dropped→onDivDropped),onChipDropped()runs first and clears the drag state.onMoveEnd()then returns early and never reaches theunsubscribe()calls, which were the only ones for the ghostmousemovesubscription. Effects:sampleTime(100)timer keeps running in the Angular zone, soApplicationRef.isStable/fixture.whenStable()never settle.closedguard sees the old subscription, which is attached to the removed ghost of the previous drag.igxDragremoves the ghost without ending the drag. A pending sampled mouse move then callsonChipLeave()→dragGhostIsOnDropGhostRow(), which throwsCannot read properties of null (reading 'getBoundingClientRect').Type of Change (check all that apply):
Component(s) / Area(s) Affected:
Query Builder (condition drag and drop), including the grids' advanced filtering dialog
How Has This Been Tested?
The five specs from #18041 (
Drag and dropsection ofquery-builder.component.spec.ts) fail on 22.3.x without the fix and pass with it.Runs on this branch:
query-builderspecs: 148 passedgrid-filtering-advancedspecs: 54 passedTest Configuration:
Screenshots / Recordings
N/A: no visual change.
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)