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

Idea: refetching status #3

Open
FKSI opened this issue Feb 6, 2024 · 3 comments
Open

Idea: refetching status #3

FKSI opened this issue Feb 6, 2024 · 3 comments

Comments

@FKSI
Copy link

FKSI commented Feb 6, 2024

In swr mode expose a "fetching state" to let the app display a skeleton for example.

@AlemTuzlak
Copy link
Contributor

hmm i'm not sure if this would be justified as this would be identical behavior to not using the package and just passing the server data as a promise / using defer without clientLoader, could you give me an example of the use-case?

@FKSI
Copy link
Author

FKSI commented Feb 15, 2024

What if you are handling like a list of items (books?) the first time you hit the page serverLoader is going to fetch the data.

Let's add in the backend 10+ items

The second time you are going to the app the clientLoader is serving the data from storage and behind the scenes the a fetch is happening (swr mode). If the fetch is slow (or your network is bad) then the it takes some time to finish and finally the app will display the new 10+ items but the UI effect will be a kind of "appearing in a blink".

If the lib exposes a "isBackgroundFetchingStatus" then in the UI you could display a banner (or whatever) warning the user that some new data might appear in the coming seconds.

Amazing work btw!

@AlemTuzlak
Copy link
Contributor

@FKSI I see, okay, I think I've figured out how to add it

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

2 participants