Group filter / search projects results for second page result does not work
Summary
Search projects by name in the UI within a group will show results just fine for the 1st page.
However, when you try to go to the subsequent page, it lost the filtering and just shows the result page of all projects within the group.
This is reproducible in gitlab.com
Steps to reproduce
- Go to https://gitlab.com/gitlab-org
- Search by name for "test" -> you'll be in the 1st page of a 2 pages result
- Go to the bottom of the screen and click for the 2nd page -> will show the second page for all projects without filtering
What is the current bug behavior?
Unable to go to the second page of the search result
What is the expected correct behavior?
Shows the second page of the search result
(internal only) ZD reference: https://gitlab.zendesk.com/agent/tickets/110613
Explanation of Bug
I believe this has something to do with the special logic we use when rendering the tree structure via updateGroups
method depending on if there is a filter in the query or not after an API request:
There are 3 places we call updateGroups
, two of which also pass a Boolean parameter to declare if there is a filter in the query. While a third call (when pagination is clicked) never passes the Boolean and thus is always false. Note that the third call does use the filter data in the API request.
By updating call 3 above to also utilize the Boolean it appears to fix the issue.
-this.updateGroups(res);
+this.updateGroups(res, Boolean(filterGroupsBy));
Before (bug) | After (potential fix) |
---|---|
Bug | Fix |
While this does appear to work I'm a bit nervous touching this file as there is a lot of logic and very specific ways we handle updates that I'm a bit nervous this could have been deliberately left off for some other edge case.
Implementation Guide
- Update
fetchPage
(no Boolean) to includeBoolean(filterGroupsBy)
parameter.this.updateGroups(res, Boolean(filterGroupsBy));