Open
Description
Bug report
Description / Observed Behavior
When using useSWRInfinite with {revalidateOnMount: true, revalidateFirstPage: false}, if there is a useLayoutEffect with change state in it, the component will not make a new request when it is again mounted.
Expected Behavior
Enter the component again need to send a new request
Repro Steps / Code Example
- Load components for the first time,success send a request
- Return to the previous page
- Enter the component again, and no request is sent
const [state, setState] = useState(true);
useLayoutEffect(() => {
setState(false);
}, []);
useSWRInfinite(index => ({
pageNum: index + 1,
pageSize: 20,
}), fetcher, {
revalidateOnMount: true,
revalidateFirstPage: false,
});
Additional Context
swr 2.2.5
react 18.3.1
Metadata
Metadata
Assignees
Labels
No labels