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 data3 Replies
sensitive-blue•2y ago
this should work regardless of prod/dev
xenial-blackOP•2y ago
Thank you for such a quick response
I just want to clarify if this pattern is fine ?
sensitive-blue•2y ago
yes it is