-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Is not sent (pristine) indicator/flag/state #329
Comments
Hi, I am glad you like this library! Actually in roadmap #306 there is a task: Regarding the idea, I think this actually be solved above getQuery, probably in reducer. Reducer could store For now I think you can solve it in 2 ways:
|
|
Hello! Thank you for your reply. For now, it's resolved at the request level. An Axios interceptor runs a casting function if it's passed in the config. It just throws a simulated not found error. The issue is not for a particular problem. It's very handy in many cases to have an ability to understand that the request is "pristine". I'm glad to know there is the roadmap with the feature coming! Looking forward to new versions. This issue can be closed. :) |
Hey @klis87 , It's not clear to me what the task in the roadmap is about as the query has already a |
@cluk3 In reducers there is even no
This task is to give 1 extra information, to distinguish between:
This flag wont be necessary for response.data like Regarding the attached article, I agree that booleans can be abused if you have many states, and state machines are better then, but in our case 90% people will need only |
I understand now, thanks a lot for the answer and for the awesome work with the library! |
@umbrella-kirill-karpov @cluk3 also |
Hello. Thank you for your library, it's great!
In some cases, we need to know that the request hasn't been sent yet at all. But
getQuery
always returns the default structure:https://github.com/klis87/redux-saga-requests/blob/master/packages/redux-saga-requests/src/selectors/get-query.js#L121
Just checking over
data
isnull
won't work as the backend may return, for example, eithernull
or a model (yes, that happens ¯_(ツ)_/¯).Is there a way to extend
defaultQuery
(not default data) or to understand, that the query is "pristine"?It looks like, just adding
pristine
flag todefaultQuery
should solve the issue as the default query is returned any time when there is no data for the query (it's not initialized/sent/etc.) in requests` state.The text was updated successfully, but these errors were encountered: