Skip to content

Commit 6287022

Browse files
authored
Merge pull request #2570 from devtron-labs/fix/app-listing-params
fix: remove page-number on apptype change
2 parents d3ed9b2 + a258d1c commit 6287022

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/components/app/list-new/AppList.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,12 @@ const AppList = ({ isArgoInstalled }: AppListPropType) => {
294294
/>
295295
)
296296

297+
const removePageNumber = (search: string) => {
298+
const searchParams = new URLSearchParams(search)
299+
searchParams.delete('pageNumber')
300+
return searchParams.toString() ? `?${searchParams.toString()}` : ''
301+
}
302+
297303
const tabs: TabProps[] = [
298304
...(serverMode === SERVER_MODE.FULL
299305
? [
@@ -304,7 +310,7 @@ const AppList = ({ isArgoInstalled }: AppListPropType) => {
304310
props: {
305311
to: {
306312
pathname: getChangeAppTabURL(AppListConstants.AppTabs.DEVTRON_APPS),
307-
search: location.search,
313+
search: removePageNumber(location.search),
308314
},
309315
'data-testid': 'devtron-app-list-button',
310316
},
@@ -318,7 +324,7 @@ const AppList = ({ isArgoInstalled }: AppListPropType) => {
318324
props: {
319325
to: {
320326
pathname: getChangeAppTabURL(AppListConstants.AppTabs.HELM_APPS),
321-
search: location.search,
327+
search: removePageNumber(location.search),
322328
},
323329
'data-testid': 'helm-app-list-button',
324330
},
@@ -332,7 +338,7 @@ const AppList = ({ isArgoInstalled }: AppListPropType) => {
332338
props: {
333339
to: {
334340
pathname: getChangeAppTabURL(AppListConstants.AppTabs.ARGO_APPS),
335-
search: location.search,
341+
search: removePageNumber(location.search),
336342
},
337343
'data-testid': 'argo-app-list-button',
338344
},
@@ -348,7 +354,7 @@ const AppList = ({ isArgoInstalled }: AppListPropType) => {
348354
props: {
349355
to: {
350356
pathname: getChangeAppTabURL(AppListConstants.AppTabs.FLUX_APPS),
351-
search: location.search,
357+
search: removePageNumber(location.search),
352358
},
353359
'data-testid': 'flux-app-list-button',
354360
},

0 commit comments

Comments
 (0)