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
- Go to a Work Item that supports children (i.e. Issue, Epic, or Objective).
- Create/add at least 10 child work items to it.
- Close the bottom 5 (i.e. 50%) work items from that list.
- Go to
app/assets/javascripts/work_items/constants.js#L253and change value ofDEFAULT_PAGE_SIZE_CHILD_ITEMSto 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 moreis clicked.
- 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
- Reload the page and turn off
Show closed itemsfrom kebab menu ofChild itemswidget as shown in above screen recording. - Start clicking
Load moreto load batches of items. - Notice how towards the end, clicking on
Load moreshows the spinner but doesn't do anything. - Once all the children are loaded,
Load morebutton is gone and instead,Show 5 closed itemsbutton is shown. - Clicking on
Show 5 closed itemswill 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 itemsbutton. 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 theLoad morebutton 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 🤖