friggframework / create-frigg-app

MIT License
0 stars 4 forks source link

Front end loads before backend causing a page refresh to be required #27

Open joncodo opened 1 year ago

joncodo commented 1 year ago

There seems to be a problem with the frontend calling /integrations.

I am hitting an issue where the network tab shows an error on integrations after log in and fails to render the list in the UI. Then if you refresh, it just works.

Maybe this is a race condition from when the UI is running to when the backend is running? GET http://localhost:3001/dev/api/integrations net::ERR_CONNECTION_REFUSED

seanspeaks commented 1 year ago

Sounds like a race condition indeed... Was playing around with parallel npm commands, interesting to know if you can parallelize but wait for the first to complete before the second runs?

sheehantoufiq commented 1 year ago

@joncodo @seanspeaks Does the skeleton loader show up? Or show up then disappear? It might be something on the frontend related to this MR and the removal of redux for the integration components

joncodo commented 1 year ago

Well once the backend service is running, the page either needs to auto reload or to show a spinner with a message in the front end.

This also fixes the user experience if the application ever goes down on the backend and not the front end.

The other thing to do is to just run the backend first and then the front end fro local development from the script. I am fine with anything that fixes this bug 😄

sheehantoufiq commented 1 year ago

@joncodo Yeah, it worked before. It showed a skeleton loader until the backend was initialized. It most likely isn't working now because redux for those components seem to have been removed with the last MR. @seanspeaks @fbsis

joncodo commented 1 year ago

Yes I do see that skeleton (I understand what you mean now). We just need to match that up with redux data listeners I guess so when the data is populated, the component renders. Which I think is what you are saying here too 👍

sheehantoufiq commented 1 year ago

Yeah, it should do that automatically if we add this code back in lines 190 for this 150 for this

Essentially the props aren't being mapped to the redux state, after rendering the page it listens from there, but instead gets added to reacts overall state so it shows up with the refresh. From the notes of that MR, I'm guessing it's unfinished with plans to move to react's context api or redux-toolkit