diff --git a/libs/graphql/src/data-providers/generic-data-provider.ts b/libs/graphql/src/data-providers/generic-data-provider.ts index 6fdec30ae..64d93b978 100644 --- a/libs/graphql/src/data-providers/generic-data-provider.ts +++ b/libs/graphql/src/data-providers/generic-data-provider.ts @@ -22,7 +22,7 @@ export interface Subscribe { callback: UpdateCallback, client: ApolloClient, variables?: OperationVariables - ): void; + ): () => void; } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/libs/react-helpers/src/hooks/use-data-provider.ts b/libs/react-helpers/src/hooks/use-data-provider.ts index 7d5ade70a..9cf3a99d3 100644 --- a/libs/react-helpers/src/hooks/use-data-provider.ts +++ b/libs/react-helpers/src/hooks/use-data-provider.ts @@ -5,7 +5,7 @@ import type { Subscribe } from '@vegaprotocol/graphql'; export function useDataProvider( dataProvider: Subscribe, - update: (delta: Delta) => boolean = () => false, + update?: (delta: Delta) => boolean, variables?: OperationVariables ) { const client = useApolloClient(); @@ -18,7 +18,7 @@ export function useDataProvider( setError(error); setLoading(loading); if (!error && !loading) { - if (!initialized.current || !delta || !update(delta)) { + if (!initialized.current || !delta || !update || !update(delta)) { initialized.current = true; setData(data); }