Handling in the frontend a separate mutation for adding child items in work item Hierarchy widget
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem
For reordering of items, adding existing items or removing any child, workItemUpdate mutation is used. In return, it returns all the children and frontend needs to separate the items to write them in the Apollo cache. When pagination for Child items widget was added in !154793 (closed), the mutation and subscription created cache conflicts. The conflict occurs as it returns the whole list from backend but there the data on the frontend is paginated. There were many items which were not yet loaded on frontend but they were in the backend response. Also, we are using manual merging of widgets data in graphql_shared/issuable_client.js#L83 due to data's complexity. To solve that, fetch policy was set to no-cache in the code which is not ideal.
Requirement
A better solution would be to have a fine grain hierarchy widget mutation, eg; workItemHierarchyAddChild, which allows users to create child item, or adds an existing child and as a response;
- return the newly added items
- If the items are already added, skip those items and do not return the error
Work item(s) already assigned
This new mutation is added in the backend, so we can now handle it on the front-end side. MR: !196291 (merged)