Record Page Navigation Arrows Cause Unnecessary skeleton loading (#6367)

@Bonapara 
Issue #6325 

- Desired Behavior
The navigation should always be visible. Clicking on a Next/Previous
arrow should immediately increment the number without switching to the
skeleton loading step.
**Done** 

Please let me know what do you think about this approach.

Thanks :)



https://github.com/user-attachments/assets/bda3608f-87e3-45bd-a7c8-4a6b48391cf2

Co-authored-by: Weiko <corentin@twenty.com>
Co-authored-by: martmull <martmull@hotmail.fr>
This commit is contained in:
nitin
2024-07-29 20:30:22 +05:30
committed by GitHub
parent 515d6fb1c5
commit 6bc7622e1e
3 changed files with 36 additions and 48 deletions

View File

@ -11,6 +11,7 @@ import { buildShowPageURL } from '@/object-record/record-show/utils/buildShowPag
import { buildIndexTablePageURL } from '@/object-record/record-table/utils/buildIndexTableURL';
import { useQueryVariablesFromActiveFieldsOfViewOrDefaultView } from '@/views/hooks/useQueryVariablesFromActiveFieldsOfViewOrDefaultView';
import { isNonEmptyString } from '@sniptt/guards';
import { useEffect, useState } from 'react';
import { capitalize } from '~/utils/string/capitalize';
export const useRecordShowPagePagination = (
@ -99,7 +100,15 @@ export const useRecordShowPagePagination = (
recordGqlFields,
});
const totalCount = Math.max(totalCountBefore ?? 0, totalCountAfter ?? 0);
const [totalCount, setTotalCount] = useState(
Math.max(totalCountBefore ?? 0, totalCountAfter ?? 0),
);
useEffect(() => {
if (totalCountBefore !== undefined || totalCountAfter !== undefined) {
setTotalCount(Math.max(totalCountBefore ?? 0, totalCountAfter ?? 0));
}
}, [totalCountBefore, totalCountAfter]);
const loading = loadingRecordAfter || loadingRecordBefore || loadingCursor;