-
Notifications
You must be signed in to change notification settings - Fork 17
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
TypeError: undefined is not an object (evaluating '_get2.queue') #55
Comments
Hey @bijuC1983 thanks for bringing this into attention. I use this in multiple projects and have not run into this issue. Could you provide more info so I can take a look at it please. Are you using redux sagas? what are you naming the offline reducer store? this |
Hello @RobPando. Thank you for your response. Yes, I am using redux-saga. |
@bijuC1983 this is great, really appreciate it. The curious thing is that |
It does return an object in console. But, when I try to get any property('offline') from that object it returns undefined. It only works after toObject(). Please note I am on 0.61.5. |
Interesting, I will look into this. Thanks again! |
Hello @RobPando I was wondering if you were able to have a look into it. |
@bijuC1983 I have not had a chance yet but I will this week. As for your question, I believe what you are trying to do is re-queue an action. There is a way to manually queue the action again, I use this for every offline request this is also good if the server is down for any reason and for your case also if it times out you can re-queue it. So if you are using redux-saga you can do something like this: import { put, call } from "redux-saga/effects";
import { queueAction } from "redux-offline-queue";
function* postBlog(action) {
cont { someParam } = action;
const response = yield call(myAPI, someParam);
if (response.ok) {
// success
else if (response.status === 500) {
// server error
// this manually adds the action back into the queue
yield put(queueAction(action))
} else {
// client error do something else
}
} let me know if this helps |
@RobPando I wonder if theres a reasonable solution to put the action on top of the queue when it fails, when the order of the actions is relevant. |
@fabcall sorry for the insanely late reply. I could split the queueing of action into 2 function a prepend and append function to queueing the action that way you can choose to queue your action to the top or at the bottom. |
Hello,
I have setup as per your example project https://github.com/RobPando/offlineTweet.
I am getting proper isConnected NetInfo callbacks. The problem is i get the error:
This happens when
yield put({type: ONLINE});
I am using 0.61.5
The text was updated successfully, but these errors were encountered: