-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Remix are you using?
1.14.0 (also on 1.15)
Are all your remix dependencies & dev-dependencies using the same version?
- Yes
Steps to Reproduce
1.) Create a resource-route (or any loader) that returns anything. In this case I'm returning json({hello: 'world'})
2.) In any route, create a state variable to track to see if it has been invoked. For example
let fetcher = useFetcher();
const [shouldCallResourceRoute, setShouldCallResourceRoute] = useState(true);
useEffect(() => {
if (shouldCallResourceRoute) {
setShouldCallResourceRoute(false); // this should cause this fetcher to never load again. But it infinite loops
fetcher.load("/resource-routes/resource");
}
}, [fetcher, shouldCallResourceRoute]);3.) Note the infinite loop / crash that happens

-Note-
I am upgrading my Remix from an earlier version where my existing code worked fine. This bug only appeared after upgrading and I was able to replicate in a code sandbox here:
Expected Behavior
The fetcher should only load once
Actual Behavior
An infinite loop occurs, crashing the page.
iamkd
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working