import moment from 'moment-timezone'; import { UseSimpleQueryProps, UseSimpleQueryReturn } from './useSimpleQuery'; export interface AutoRefreshOptions { refreshInterval?: moment.Duration; enableAutoRefresh?: boolean; onRefreshingChange?: (refreshing: boolean) => void; onConnectionError(): void; onOtherError?(e: unknown): void; } export type UseSimpleAutoRefreshQueryProps = Pick, 'queryParams' | 'query' | 'shouldQueryImmediately' | 'onResultReceived' | 'onLoadingChange' | 'debounceDelay'> & AutoRefreshOptions; /** * @deprecated * * Performs a query on mount and repeats the query according to `refreshInterval`. * * Example: * ``` * const { doQuery, doQueryAsync } = useParameterlessAutoRefreshQuery({ * queryParams: workDocId, * query: (id) => api.workDoc.get({ id }), * shouldQueryImmediately: (prev, cur) => true, * onResultReceived: (workDoc) => { * setWorkDoc(workDoc) * dispatch(setShowBackendUnreachableAlert(false)) * }, * refreshInterval: dayjs.duration(1, 'minute'), * onConnectionError: () => dispatch(setShowBackendUnreachableAlert(true)) * }) * ``` * * @typeParam TQueryParams the parameters of the query * @typeParam TResult the type returned by the query */ export declare function useSimpleAutoRefreshQuery(props: UseSimpleAutoRefreshQueryProps): UseSimpleQueryReturn;