T
TanStack2y ago
xenial-black

select performs correctly in local but in production i think it fails.

const [searchTerm, setSearchTerm] = useState(''); const { data: projectData } = useQuery({ queryKey: [${ProjectQueryKeys.fetchProjects}], queryFn: fetchProjects, select: (data) => { if (searchTerm) { return data } else { return data?.filter((project) => project.status?.name === 'In Progress') } } }); i am using Next JS with app directory. This works correctly in local but fails in production. Basically i am fetching the entire list of projects and technically show only the list of projects that are in progress , but if a user searches for a project , return the entire data
3 Replies
sensitive-blue
sensitive-blue2y ago
this should work regardless of prod/dev
xenial-black
xenial-blackOP2y ago
Thank you for such a quick response I just want to clarify if this pattern is fine ?
sensitive-blue
sensitive-blue2y ago
yes it is

Did you find this page helpful?