Fix UI bug where inherited_page=0 would be incorrectly added to some URLs (#11971)

This commit is contained in:
gillespi314 2023-05-26 11:47:35 -05:00 committed by GitHub
parent 3d478614fb
commit 5662d2cdcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 9 deletions

View File

@ -0,0 +1 @@
- Fixed UI bug where `inherited_page=0` was incorrectly added to some URLs

View File

@ -36,15 +36,11 @@ const rebuildQueryStringWithTeamId = (
const inheritedPageIndex = parts.findIndex((p) =>
p.startsWith("inherited_page=")
);
const newPagePart = "page=0";
const newInheritedPagePart = "inherited_page=0";
if (pageIndex) {
parts.splice(pageIndex, 1, newPagePart);
if (pageIndex !== -1) {
parts.splice(pageIndex, 1, "page=0");
}
if (inheritedPageIndex) {
parts.splice(inheritedPageIndex, 1, newInheritedPagePart);
if (inheritedPageIndex !== -1) {
parts.splice(inheritedPageIndex, 1, "inherited_page=0");
}
const teamIndex = parts.findIndex((p) => p.startsWith("team_id="));
@ -52,7 +48,7 @@ const rebuildQueryStringWithTeamId = (
const newTeamPart =
newTeamId > APP_CONTEXT_ALL_TEAMS_ID ? `team_id=${newTeamId}` : "";
if (teamIndex < 0) {
if (teamIndex === -1) {
// nothing to remove/replace so add the new part (if any) and rejoin
return joinQueryStringParts(
newTeamPart ? parts.concat(newTeamPart) : parts