fix: empty state should not appear during table loading (#3040)

* fix: empty state should not appear during table loading

* feat: add initla load tracking

* Fix lint

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Andrey Kud
2023-12-20 10:19:02 -03:00
committed by GitHub
parent d59a37129f
commit dd044e8f66
7 changed files with 18 additions and 27 deletions

View File

@ -6,6 +6,7 @@ import { useObjectNameSingularFromPlural } from '@/object-metadata/hooks/useObje
import { turnSortsIntoOrderBy } from '@/object-record/object-sort-dropdown/utils/turnSortsIntoOrderBy';
import { useRecordTableScopedStates } from '@/object-record/record-table/hooks/internal/useRecordTableScopedStates';
import { useRecordTable } from '@/object-record/record-table/hooks/useRecordTable';
import { isRecordTableInitialLoadingState } from '@/object-record/record-table/states/isRecordTableInitialLoadingState';
import { turnFiltersIntoObjectRecordFilters } from '@/object-record/utils/turnFiltersIntoWhereClause';
import { signInBackgroundMockCompanies } from '@/sign-in-background-mock/constants/signInBackgroundMockCompanies';
@ -41,6 +42,10 @@ export const useObjectRecordTable = () => {
foundObjectMetadataItem?.fields ?? [],
);
const setIsRecordTableInitialLoading = useSetRecoilState(
isRecordTableInitialLoadingState,
);
const { records, loading, fetchMoreRecords, queryStateIdentifier } =
useFindManyRecords({
objectNameSingular,
@ -48,6 +53,7 @@ export const useObjectRecordTable = () => {
orderBy,
onCompleted: () => {
setLastRowVisible(false);
setIsRecordTableInitialLoading(false);
},
});