-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Description
Describe the bug
When i refetch with enabled=false data is undefined but the strange thing is when I press backspace it returns the data
'use client';
import { useState } from 'react';
import { useFuncToolsQuery } from '~/generated/aitools/graphql';
export default function DynamicEntitySelect() {
const [inputValue, setInputValue] = useState('');
const { data, isFetching, refetch, isLoading } = useFuncToolsQuery(
{
first: 100,
where: {
...(inputValue ? { nameContainsFold: inputValue } : {}),
},
},
{
// enabled: !isBlank(workspaceId),
enabled: false,
staleTime: 0,
// keepPreviousData: true,
}
);
console.log('data', data, isLoading);
return (
<>
<input
className='border'
type='text'
onChange={(e) => {
setInputValue(e.target.value);
refetch();
}}
/>
</>
);
}Your minimal, reproducible example
https://stackblitz.com/edit/tanstack-query-ac2kebkt?file=src%2Findex.tsx
Steps to reproduce
- Copy and paste
iphone - Now press backspace it still searches for
iphonenotiphon
Expected behavior
it should search for data
How often does this bug happen?
None
Screenshots or Videos
Screen.Recording.2025-03-27.at.9.09.52.PM.mov
Platform
- OS: MAc
- Browser: Chrome
- Version:
"@tanstack/react-query": "^5.67.3"
Tanstack Query adapter
react-query
TanStack Query version
5.67.3
TypeScript version
5.8.2
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels