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

fetch data after queued request has been sent #1695

Closed
0xmaayan opened this issue Oct 11, 2018 · 4 comments
Closed

fetch data after queued request has been sent #1695

0xmaayan opened this issue Oct 11, 2018 · 4 comments

Comments

@0xmaayan
Copy link

Hey, I am having an app that uses workbox.

The flow for one feature of the app -

when making a post request (when offline), I store the data on indexDB (manually) and (using background sync plugin) the request has been added to a queue.

When the user going online, the queued request has been executing. At this point, I want to have the data response from the server. (the same response that I would have if I was online)

So, Is it possible to have this data?

From what I can see, the plugin stores the whole request in the indexDB but I can't find a way to see the data that has been sent or the response of the server after the request has been sent.

My main goal is to be able to update the data I stored on indexDB with the response I get from the server.

Thanks!

screen shot 2018-10-11 at 11 38 44

@philipwalton
Copy link
Member

Hmmm, it looks like the documentation for the background sync Queue class callbacks.queueDidReplay function isn't quite right. It's not invoked with an array of StorableRequest objects, it's invoked with an array of {request, response} objects (here's the code).

If all you need is the final responses, then that should work for you.

However, if you need to modify the replay behavior of the queue based on the response of an individual replayed request, there's unfortunately no good solution for that now (but I'm hoping to release something in v4).

See #1503 (comment) for more details.

@philipwalton
Copy link
Member

FYI, I'm submitted #1710, which I believe will address your issue. Please take a look at that PR and let me know what you think.

@0xmaayan
Copy link
Author

0xmaayan commented Oct 16, 2018 via email

@jeffposnick
Copy link
Contributor

This is addressed in Workbox v4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants