Send correct value in subscription when a new parent is assigned after clearing old value on work items
Problem
While working on !161013 (merged), there was an observation where the ancestors in the ancestry widget becomes blank while reassigning a parent. This is happening when a current parent is unassigned and a new parent is set from the Parent
widget.
Following are the events and response occurring during the steps:
-
When the parent is unassigned, the
workItemUpdate
mutation is fired. -
Following response is received in
workItemUpdated
subscription in the hierarchy widget{ "data": { "workItemUpdated": { ... "widgets": [ ... { "type": "HIERARCHY", "hasParent": false, "parent": null, "ancestors": { "nodes": [], "__typename": "WorkItemConnection" }, "__typename": "WorkItemWidgetHierarchy" }, ... ], "__typename": "WorkItem" } } }
-
Now, if a new parent is set from the dropdown,
workItemUpdate
mutation is successfuly fired. -
But this time the work item itself is blank like below
{ "data": { "workItemUpdated": null } }
-
Also, if again a parent is set from the dropdown, then we get correct response like below.
{ "data": { "workItemUpdated": { ... "widgets": [ ... { "type": "HIERARCHY", "hasParent": true, "parent": { "id": "gid://gitlab/WorkItem/1461", "__typename": "WorkItem" }, "ancestors": { "nodes": [ { "id": "gid://gitlab/WorkItem/1461", "iid": "195", "confidential": false, "workItemType": { "id": "gid://gitlab/WorkItems::Type/6", "name": "Objective", "iconName": "issue-type-objective", "__typename": "WorkItemType" }, "title": "Objective dups 1", "state": "OPEN", "reference": "gitlab-org/gitlab-test#195", "createdAt": "2024-05-23T08:59:01Z", "closedAt": null, "webUrl": "http://gdk.test:3000/gitlab-org/gitlab-test/-/work_items/195", "widgets": [ ... ], "__typename": "WorkItem" } ], "__typename": "WorkItemConnection" }, "__typename": "WorkItemWidgetHierarchy" }, ... ], "__typename": "WorkItem" } } }
Screen recording
Screen Recording 2024-07-29 at 6.20.25 PM.mov
Expectation
When the parent is reassigned, the workItemUpdated
should have the work item with proper ancestor data.
Steps to reproduce
- Visit any work item
- Set a parent using Parent widget from the side panel
- Clear the value of the parent using
Unassign
button in the dropdown - Reassign a parent value
To check the subscription data,
- Find
cable
network request after reloading the page - Make sure the WebSocket filter is selected as
WS
on the top-bar settings - Filter the event using
workItemAncestorsUpdated
- Check the request which has
message
field in it