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

Store (some) data offline in parallel to posting it to the API #7367

Closed
tofumatt opened this issue Jun 19, 2018 · 15 comments · Fixed by #16490
Closed

Store (some) data offline in parallel to posting it to the API #7367

tofumatt opened this issue Jun 19, 2018 · 15 comments · Fixed by #16490
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Offline Related to offline editing [Feature] Saving Related to saving functionality REST API Interaction Related to REST API [Type] Enhancement A suggestion for improvement.
Milestone

Comments

@tofumatt
Copy link
Member

As part of #6322, we should be storing post data and other things we'd submit to the REST API also offline in offline storage. It's probably best to use something like localForage for this task or something else that lets us access IndexedDB easily, because localStorage's API is blocking, it has a small data limit, and won't let us grow if we want to do things like save media offline for background uploading (like the mobile apps).

To start with this we probably just want to save anything we post to the REST API offline so data isn't lost. After that we may want the app to look for offline data that is newer than what's on the server and restore that instead.

@tofumatt tofumatt added REST API Interaction Related to REST API [Feature] Saving Related to saving functionality [Feature] Offline Related to offline editing labels Jun 19, 2018
@tofumatt tofumatt self-assigned this Jun 19, 2018
@tofumatt
Copy link
Member Author

FYI: I've experimented with this and saving the data offline is straightforward, but right now it's not possible to only implement this in core-data, because certain autosave actions and other requests happen outside it, so stuff like autosave has to be managed/dealt with separately.

I think something like #7546 might help implement this because the offline storage shouldn't be blocking either.

For now I'm leaving this because the implementations I managed to get working locally were hacky and not future-looking, but once everything is moved to core-data I think I can look at this again.

@westonruter
Copy link
Member

As noted in #6322 (comment) what about using service workers for this? Background sync could be used to push anything to the server once reconnected, and in the mean time anything PUT could be used as the response for a GET request.

@tofumatt
Copy link
Member Author

tofumatt commented Aug 6, 2018

Yup, it's definitely possible to use service workers, I'd just want to make sure we're okay with it being a progressive enhancement then, as IE 11 users and earlier iOS users will miss out.

tofumatt added a commit that referenced this issue Aug 28, 2018
@danielbachhuber danielbachhuber added this to the WordPress 5.0 milestone Oct 18, 2018
@danielbachhuber danielbachhuber added the [Type] Enhancement A suggestion for improvement. label Oct 18, 2018
@danielbachhuber
Copy link
Member

@tofumatt Was this addressed or does it need additional work?

@aduth
Copy link
Member

aduth commented Oct 18, 2018

Related: #9383

@tofumatt
Copy link
Member Author

tofumatt commented Oct 18, 2018 via email

@getsource
Copy link
Member

Going to drop this back into 5.0 for consideration, to see if anyone else has time to handle this. I don't think we need to make the experience better than it is in TinyMCE, but to me -- at least matching that reliability in terms of saved/lost posts is important.

@getsource getsource modified the milestones: Future: 5.1, WordPress 5.0 Nov 8, 2018
@mtias
Copy link
Member

mtias commented Nov 16, 2018

Is anyone working on this at the moment?

@tofumatt tofumatt removed their assignment Nov 16, 2018
@tofumatt
Copy link
Member Author

No, and while I'd like to, I've unassigned myself for now so someone else potentially interested doesn't skip over it because they see my assignment.

I've moved it out of this milestone for now.

@mtias
Copy link
Member

mtias commented Nov 16, 2018

Thanks.

@danielbachhuber
Copy link
Member

@tofumatt @mtias Are we knowingly dropping this from the 5.0 release?

@getsource
Copy link
Member

To be more precise: Does this mean that you're deciding to drop this feature from WordPress?

@tofumatt
Copy link
Member Author

tofumatt commented Nov 20, 2018 via email

@jdevalk
Copy link
Contributor

jdevalk commented Nov 20, 2018

We’re dropping this from the 5.0 release but not from WordPress.

I'm sorry but this is not how it works. Consider this: if your email client, that has always auto-saved your drafts, suddenly no longer auto-saves them. You complain, and the response it: "yeah we hope to get that back by the next version." Is that reliable software in your eyes?

tofumatt added a commit that referenced this issue Nov 20, 2018
@tofumatt
Copy link
Member Author

There are plenty of new versions of software, especially big rewrites/re-imaginings that remove features. Gmail does it, MacOS does it, etc. I understand the desire for backward-compatibility and not losing features, but I don't think we can ship a good implementation now.

"Reliable software" could just as easily mean "software that isn't buggy and is well-tested" as "software whose feature set never changes". In this case: striving for the former neglects the latter, yes. That is not always the case and I agree: it's not ideal.


I've been working on a patch that uses localForage to save the data but just noticed the error that it's not compatible with WordPress's license. That's my bad, but I think any approach that uses localStorage instead (the only "fast-to-implement" option) would either break or require a migration strategy in the future.

I would rather do this right later, because we won't even be exposing UI for this; just saving the data for now. And if a plugin is written to restore that data we'll essentially have an API to support that we don't like.

I think it's too rushed a timeline to ship this feature for WordPress 5.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backwards Compatibility Issues or PRs that impact backwards compatability [Feature] Offline Related to offline editing [Feature] Saving Related to saving functionality REST API Interaction Related to REST API [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants