Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setLoading needs to split #46

Open
zik200 opened this issue Jan 18, 2024 · 0 comments
Open

setLoading needs to split #46

zik200 opened this issue Jan 18, 2024 · 0 comments

Comments

@zik200
Copy link

zik200 commented Jan 18, 2024

setLoading(false);

setLoading(false);

if (loading || error) {

Currently setLoading is shared with the redux store initialization and the server-status check.

If any one of them passes, the app renders.
So you can have:

  1. possibility that the server is down, but redux initialized successfully, so no "loading.." will occur unless 'error' flag is also set quickly.
  2. Even worse, the server-status check completes really fast, before redux store is initialized, and the app tries to acces useState for example before the store is up. (Ask me how i know 😉)

Better to split the two, have two flags and check for both.

Vasant79 added a commit to Vasant79/SocialEcho that referenced this issue Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant