Hello everyone,
I'm facing a problem that appeared when updating NextJs from 15.2.1 to 15.2.2 and higher. I reproduced the problem on Windows and Linux.
Details :
Because I need a client information (the current datetime of the user), I need to fetch data from a client component. Since NextJs 15.2.2, my data fetching worked like a charm, but now I have a regression.|
I based my sourcecode on the following part of the documentation.
I'm using useEffect and a server action to fetch data (maybe not the sexiest way to fetch data ^^).
Below, you'll find the small part of the client component that stopped working with this NextJs update (without changing anything else) :
Source code :
const fetchEvents = useCallback(async () => { try { const localDateString = new Date().toLocaleString(); const filters = { participatingonly: isParticipatingOnly, showoldevents: isShowOldEvents, }; console.log('before'); //const newEvents = await fetch('/api/web/events')
const newEvents = await getFilterdEvents( currentSearch, localDateString, filters ); console.log('after'); setEvents(newEvents); } catch (error) { console.error("Error fetching events:", error); } }, [currentSearch, isShowOldEvents, isParticipatingOnly]);
useEffect(() => { setIsLoading(true); async function loadData() { try { await fetchEvents(); } finally { setIsLoading(false); } }; loadData(); console.log('end of useEffect'); }, [fetchEvents]);
In the source code above, console.log('before'); hit (I see before in the browser console), but I don't know why getFilterdEvents is never called, console.log('after'); is never hit, but console.log('end of useEffect'); at the end of useEffect is visible in the browser.
No server or client error, no warning. If I add for example a console.log inside the fetchEvents, the fast refresh make it works once and if I replace the server action call by for example a fetch to an API endpoint it works.
What was done in Next 15.2.2 to make it buggy ? Can you help me please ? :)