feat: activate standard objects in New Object page (#2232)
* feat: activate standard objects in New Object page Closes #2010, Closes #2173 * Pagination limit = 1000 * Various fixes --------- Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
import { useMemo } from 'react';
|
||||
import { useQuery } from '@apollo/client';
|
||||
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar/hooks/useSnackBar';
|
||||
import {
|
||||
MetadataObjectsQuery,
|
||||
MetadataObjectsQueryVariables,
|
||||
@ -15,15 +16,28 @@ import { useApolloMetadataClient } from './useApolloMetadataClient';
|
||||
export const useFindManyMetadataObjects = () => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
|
||||
const { enqueueSnackBar } = useSnackBar();
|
||||
|
||||
const {
|
||||
data,
|
||||
fetchMore: fetchMoreInternal,
|
||||
loading,
|
||||
error,
|
||||
} = useQuery<MetadataObjectsQuery, MetadataObjectsQueryVariables>(
|
||||
FIND_MANY_METADATA_OBJECTS,
|
||||
{
|
||||
client: apolloMetadataClient ?? undefined,
|
||||
skip: !apolloMetadataClient,
|
||||
onError: (error) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('useFindManyMetadataObjects error : ', error);
|
||||
enqueueSnackBar(
|
||||
`Error during useFindManyMetadataObjects, ${error.message}`,
|
||||
{
|
||||
variant: 'error',
|
||||
},
|
||||
);
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
@ -47,5 +61,6 @@ export const useFindManyMetadataObjects = () => {
|
||||
hasMore,
|
||||
fetchMore,
|
||||
loading,
|
||||
error,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user