I’ve got a MERN chat app that I’m trying to make for my resume, but a problem that I’m running into is that if I change between my profile page and chat page a couple of times, the Axios request that is sent will not be received by the server. This is somewhat fixed by manually refreshing the page, but doesn’t resolve it happening over time. The initial requests function normally, but over time, my server stops receiving requests from that specific client.
I added navigate as a dependency just because I would get a warning in the terminal stating that it was missing it as a dependency if I used an empty dependency. Even if I empty out the dependency array, or use no dependency array at all, the issue continues to occur consistently. The code still just runs once, only when the page is loaded. The code in the block still seems to run, as when I add a console.log statement in the useEffect block, it will still print out. Once the client is in this state, even if I navigate to the chat page, it will not receive any data from the server. For some reason, it seems as though the Signin page is not subject to this, even though it goes through the same exact route as the other two pages. Is there some sort of error handling I can do with Axios?