Skip to content

Commit 9dd6585

Browse files
committed
Merge branch 'feature/add-assets-order' into feature/upgrade-access-feature
2 parents b15e315 + 5c27c6b commit 9dd6585

File tree

5 files changed

+27
-8
lines changed

5 files changed

+27
-8
lines changed

src/components/PaginatedNavigation.tsx

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
PaginationNext,
99
PaginationEllipsis,
1010
} from '@/components/ui/pagination';
11+
import useUserStore from '@/stores/useUser.store';
1112

1213
type PaginationControlsProps = {
1314
currentPage: number;
@@ -20,16 +21,32 @@ export const PaginatedNavigation = ({
2021
totalPages,
2122
onPageChange,
2223
}: PaginationControlsProps) => {
23-
// Keep stable totalPages to prevent pagination from disappearing during loading
24-
const lastValidTotalPagesRef = useRef<number>(1);
24+
const { chainId } = useUserStore();
2525

26-
// Only update the ref if we have a valid totalPages that's greater than or equal to the current one
27-
// This prevents the pagination from shrinking during loading states
28-
if (totalPages > 0 && totalPages >= lastValidTotalPagesRef.current) {
29-
lastValidTotalPagesRef.current = totalPages;
26+
const lastValidTotalPagesRef = useRef(1);
27+
const lastChainIdRef = useRef<number | null>(null);
28+
const chainChangeFrameRef = useRef(0);
29+
30+
const chainHasChanged = chainId !== lastChainIdRef.current;
31+
32+
if (chainHasChanged) {
33+
lastChainIdRef.current = chainId ?? null;
34+
chainChangeFrameRef.current = 0;
35+
} else {
36+
chainChangeFrameRef.current++;
37+
}
38+
39+
let stableTotalPages = lastValidTotalPagesRef.current;
40+
41+
const isRecentChainChange = chainChangeFrameRef.current <= 5;
42+
43+
if (chainHasChanged || isRecentChainChange) {
44+
stableTotalPages = Math.max(totalPages, 1);
45+
} else if (totalPages > 0 && totalPages >= lastValidTotalPagesRef.current) {
46+
stableTotalPages = totalPages;
3047
}
3148

32-
const stableTotalPages = lastValidTotalPagesRef.current;
49+
lastValidTotalPagesRef.current = stableTotalPages;
3350

3451
// Don't render pagination if no pages or invalid state
3552
if (!stableTotalPages || stableTotalPages <= 0 || currentPage <= 0) {

src/externals/iexecSdkClient.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export async function initIExecSDKs({
3737
{ ethProvider: provider },
3838
{ allowExperimentalNetworks: true }
3939
);
40-
console.log('config', provider);
4140
iExec = new IExec(config);
4241

4342
IEXEC_CLIENT_RESOLVES.forEach((resolve) => resolve(iExec!));

src/modules/apps/app/AppAccessTable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function useAppAccessData({
3636
dataset: 'any',
3737
app: appAddress,
3838
workerpool: 'any',
39+
requester: 'any',
3940
page: apiBatch,
4041
pageSize,
4142
});

src/modules/datasets/dataset/DatasetAccessTable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ function useDatasetAccessData({
3636
dataset: datasetAddress,
3737
app: 'any',
3838
workerpool: 'any',
39+
requester: 'any',
3940
page: apiBatch,
4041
pageSize,
4142
});

src/modules/workerpools/workerpool/WorkerpoolAccessTable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ function useWorkerpoolAccessData({
4343
dataset: 'any',
4444
app: 'any',
4545
workerpool: workerpoolAddress,
46+
requester: 'any',
4647
page: apiBatch,
4748
pageSize,
4849
});

0 commit comments

Comments
 (0)