gabotaco / rc-website-web

1 stars 6 forks source link

First time visiting the businesses page after login yields an error #6

Closed YeahItsRock closed 2 years ago

YeahItsRock commented 2 years ago

https://www.rockwelltransport.com/home/ttools/biz/

Visiting the page after login yields the following error: "There was an error getting their tycoon businesses"

After the error is accepted, the page loads businesses successfully.

PuckishRogue91 commented 2 years ago

I'm looking at this one.

PuckishRogue91 commented 2 years ago

The page is being reloaded and is cancelling pending API requests. Because the error handlers use alert, this freezes the reload and shows the alert even though there is no actual error in this case. Not sure why the page is being reloaded yet. Any ideas?

gabotaco commented 2 years ago

It seems like react is causing the page to reload. Looking into it people are saying a couple things.

Some say that it's because we're trying to load a lot of data and adding pagination will fix it but if that's the case we should be experiencing this on the managers page but we don't. https://stackoverflow.com/questions/49755821/when-using-create-react-app-why-does-the-development-server-keep-disconnecting

Another thing is changing our nginx config will fix this problem but this still happens on local development which doesn't use nginx https://github.com/facebook/create-react-app/issues/8203#issuecomment-571605090

I'm not sure because it doesn't seem to be a timeout issue since it happens so fast. Seems to be linked with our call to tycoon since this problem happens on all our pages that call the tycoon server, so this could be an issue with how the backend handles this

image

Another thing is it's possible caching is what helps this error only pop up the first time

PuckishRogue91 commented 2 years ago

It looks like all of these similar issues are because React is navigating to the new route and then reloading the webpage, so each route change loads within the app, but then completely reloads the browser unnecessarily. Looking to see if I can find the cause.