Skip to content

Load more button on Hierarchy widget fetches children in the background when Show closed items toggle is OFF

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

In Hierarchy Widget AKA Child items, if user has Show closed items toggle set to Off, we run into a situation where if user has loaded all the open children using Load more and now next batch of children are all closed items, clicking on Load more doesn't do anything visually, although it is fetching those children behind the scenes but not showing them due to Show closed items toggle being Off, once all the children are loaded, the Load more button is gone and now we show Show n closed items (n being number of closed items currently hidden).

Screen_Recording_2025-01-30_at_5.23.17_PM

Steps to reproduce

  1. Go to a Work Item that supports children (i.e. Issue, Epic, or Objective).
  2. Create/add at least 10 child work items to it.
  3. Close the bottom 5 (i.e. 50%) work items from that list.
  4. Go to app/assets/javascripts/work_items/constants.js#L253 and change value of DEFAULT_PAGE_SIZE_CHILD_ITEMS to 2.
    • We're changing page size to a small number just to test this behaviour, this will cause only 2 children to load at a time when Load more is clicked.
  5. Reload the page and turn off Show closed items from kebab menu of Child items widget as shown in above screen recording.
  6. Start clicking Load more to load batches of items.
  7. Notice how towards the end, clicking on Load more shows the spinner but doesn't do anything.
  8. Once all the children are loaded, Load more button is gone and instead, Show 5 closed items button is shown.
  9. Clicking on Show 5 closed items will eventually show those closed children.

Proposed solution

Scenario 1 (All open items have loaded, but there are still more items to load)

  • Show Show closed items button. Upon clicking this, the setting (and toggle) updates to showing closed items. It shows any closed items that have already been loaded but are hidden, while now showing the Load more button as well (since there are more items to load). Pagination continues as normal after this.

Scenario 2 (All items are loaded)

  • Show Show closed items button. Upon clicking this, the setting (and toggle) updates to showing closed items. It shows the closed items that were already loaded. Since all items have been loaded, no other button is present.
Edited by 🤖 GitLab Bot 🤖