Intended outcome:
I tried to implement debounce tech with userQuery on my project and it didn't work.
Actual outcome:
I would like something like this implementation, but with the use of useQuery
const debouncedSearchTerm = useDebounce(offersQueryVariables, 200);
useEffect(() => {
(async () => {
await client.query({ query: getSupportOffers, variables: offersQueryVariables });
})();
}, [debouncedSearchTerm]);
How to reproduce the issue:
Version
@Jamikk I'm finding myself in a similar situation - what was your solution here?
@Jamikk I'm finding myself in a similar situation - what was your solution here?
Hi!
For instance
const SEARCH_DEBOUNCE_TIMEOUT = 200;
const [state, dispatch] = useReducer(reducer, initialState);
// from https://usehooks.com/useDebounce/
const debounceSearch = useDebounce(state.searchValue, SEARCH_DEBOUNCE_TIMEOUT);
const { data, loading, refetch } = useQuery(INQUIRIES_SEARCH, {
variables: {
search: debounceSearch,
page: currentPage,
count: 10,
sort: sortByDefault,
},
pollInterval: POLL_INTERVAL,
fetchPolicy: 'network-only',
});
Most helpful comment
Hi!
For instance