Skip to content

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

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:

  1. 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).
  2. Enable namespace work items -
    1. Feature.enable(:namespace_level_work_items)
    2. Feature.enable(:work_item_epics)
  3. If the backend MR is not merged, increase the limit in backend like over here.

Steps to verify:

  1. Login with any user

  2. Go to any Group or Project and create an Epic or Objective

  3. 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
    
  4. Check if Load more button is appearing

  5. Check if reordering is working after loading more items

  6. Add few items using the Add button functionality.

  7. Try to remove few items from the list

Check similar behaviour on Issue's Child items widget.

Related to #463881 (closed)

Edited by Rajan Mistry

Merge request reports