This repository has been archived by the owner on Jan 1, 2025. It is now read-only.
Report loading progress for complex selectors to users #2239
Unanswered
openventures
asked this question in
Q&A
Replies: 1 comment
-
I am facing something close to this, I want to set the state of an atom for error handling when using an axios request, but I can't find a way to use it. in my case I use react-toastify and it needed to be used in a tsx file, so i use the atom for that. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What is currently the recommended way to show loading progress / information to a user for long loading selectors.
e.g.
showing something like a progress indicator like "Loaded xx parts..." is not possible with this scenario.
Extracting the loop body into it's own selectors and using
waitForNone
, doesn't work without a lot hacks, since the calls need to be performed in sequence...In the past I used special loader classes (stored in mutable atoms (yikes)) to simulate pages again, to use the
waitForNone
approach, but this isn't very composable and still feels hacky.In an ideal world, I would wish for an api like:
to update an loading progress
atom
from the selector get function (but I understand why this will result in all kinds of issues).using hooks to manage this feels a bit wrong, especially if the base loading selectors is also used by multiple other selectors down stream, that would mean having a hook
useMyQuery()
, but then usinguseRecoilValue(secondSelector)
and thus leaking the internals ofsecondSelector
to the consumer.So I guess my question is, how do you handle these types of paginated data sources, where you want to load the results at once.
Before anyone says, "let the user paginate using UI controls, instead of loading everything up front", an example use case would be a frontend using a generic api to generate a big CSV export, without having an API endpoint to do it server side, and low limits for page sizes.
Beta Was this translation helpful? Give feedback.
All reactions