Separate children field from work item query
What does this MR do and why?
This is a setup MR for upcoming MR which will add pagination support for Child items widget. This MR will
- separate the
children
attribute from work_items/graphql/work_item_widgets.fragment.graphql#L72 and will load using work_items/graphql/work_item_tree.query.graphql#L6 - add loader to the Child items for OKRs and Epic work items
- set pageSize to
1000
. The backend MR !159137 (closed) will increase the page size to1000
as default limit was100
which will be an issue for Epics with more than 100 child items.
Note: The code is extracted part of Draft: Add pagination support for Hierarchy Wid... (!154793 - closed).
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
Screen Recording 2024-07-12 at 7.39.44 PM.mov | Screen Recording 2024-07-12 at 7.38.26 PM.mov |
How to set up and validate locally
Prerequisites:
- Enable the OKRs feature as mentioned in the OKRs docs (e.g.
::Feature.enabled?(:okrs_mvc, Project.find(<PROJECT_ID>))
and the namespace must have Ultimate plan). - Enable namespace work items -
Feature.enable(:namespace_level_work_items)
Feature.enable(:work_item_epics)
- If the backend MR is not merged, increase the limit in backend like over here.
Steps to verify:
-
Login with any user
-
Go to any Group or Project and create an Epic or Objective
-
Add more than 100 items in Child items section. This script can be used to add 100+ items.
parent_epic = Epic.last # Epic.last for last created epic parent_epic_work_item = parent_epic.work_item project = Project.find(27) # project where you want to create the issues in user = User.where(username: 'root').first # the user you want to create the work item with (0..105).each do |i| WorkItems::CreateService.new(container: project, perform_spam_check: false, current_user: user, params: { title: "Work item #{i}" }, widget_params: { hierarchy_widget: { parent: parent_epic_work_item } } ).execute end
-
Check if Load more button is appearing
-
Check if reordering is working after loading more items
-
Add few items using the
Add
button functionality. -
Try to remove few items from the list
Check similar behaviour on Issue's Child items
widget.
Related to #463881 (closed)