Skip to content

Commit b000b8c

Browse files
tcnichollongshuicy
andauthored
1098 superamin messes up dataset pagination (#1104)
* “” * ran pre-commit * set page to 1 if superdmin mode chosen * reverting this change * i think this fixes 'mine' when superadmin is enabled * use the current page num, only set on tab switch * remove inline comments * Update Explore.tsx remove not used inline comment --------- Co-authored-by: Chen Wang <[email protected]>
1 parent e5ed21e commit b000b8c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

frontend/src/components/Explore.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,14 @@ export const Explore = (): JSX.Element => {
4949

5050
// Admin mode will fetch all datasets
5151
useEffect(() => {
52-
if (adminMode) listDatasets(0, limit, true);
53-
else listDatasets((currPageNum - 1) * limit, limit, mine);
54-
}, [adminMode, deletedDataset, mine, currPageNum, limit]);
52+
if (adminMode) {
53+
if (selectedTabIndex === 1) {
54+
listDatasets((currPageNum - 1) * limit, limit, true);
55+
} else {
56+
listDatasets((currPageNum - 1) * limit, limit, false);
57+
}
58+
} else listDatasets((currPageNum - 1) * limit, limit, mine);
59+
}, [adminMode, deletedDataset, mine, currPageNum, selectedTabIndex, limit]);
5560

5661
// switch tabs
5762
const handleTabChange = (
@@ -61,11 +66,9 @@ export const Explore = (): JSX.Element => {
6166
if (newTabIndex === 1) {
6267
setMine(true);
6368
setCurrPageNum(1);
64-
listDatasets(0, limit, true);
6569
} else {
6670
setMine(false);
6771
setCurrPageNum(1);
68-
listDatasets(0, limit, false);
6972
}
7073
setSelectedTabIndex(newTabIndex);
7174
};

0 commit comments

Comments
 (0)