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

Autosaving while offline (sessionStorage) #3842

Closed
swissspidy opened this issue Aug 12, 2020 · 3 comments · Fixed by #12129
Closed

Autosaving while offline (sessionStorage) #3842

swissspidy opened this issue Aug 12, 2020 · 3 comments · Fixed by #12129
Assignees
Labels
Group: Editing Main editing features Group: Workspace A group encompassing all of workspace – everything inside the canvas and sidebar P2 Should do soon Status: Needs More Info Follow-up required in order to be actionable. Type: Enhancement New feature or improvement of an existing feature

Comments

@swissspidy
Copy link
Collaborator

swissspidy commented Aug 12, 2020

Feature Description

When the user is editing a story while being offline, can we store autosaves in sessionStorage like Gutenberg does?

Then we could display messages like "The backup of this post in your browser is different from the version below. Restore backup"

Alternatives Considered

Additional Context

Related: #3841 (Add message when Autosave exists)

Original Gutenberg implementation: WordPress/gutenberg#16490

Code is currently here: https://github.com/WordPress/gutenberg/blob/7d880708c6281c185256b8e7d3dffe178da33d09/packages/editor/src/components/local-autosave-monitor/README.md


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance Criteria

Implementation Brief

@swissspidy swissspidy added Type: Enhancement New feature or improvement of an existing feature Group: Editing Main editing features Pod: Prometheus (Workspace) labels Aug 12, 2020
@o-fernandez o-fernandez added the P3 Nice to have label Sep 22, 2020
@dreamofabear dreamofabear added the Status: Needs More Info Follow-up required in order to be actionable. label Sep 24, 2020
@barklund barklund added the Group: Workspace A group encompassing all of workspace – everything inside the canvas and sidebar label Oct 5, 2020
@swissspidy
Copy link
Collaborator Author

Current Gutenberg implementation:

https://github.com/WordPress/gutenberg/blob/d694d782feb0bed461efbf390f87b4baaf9b32f9/packages/editor/src/components/local-autosave-monitor/index.js

Technically it's rather simple:

  1. The content is regularly saved to session storage.
  2. Whenever a proper autosave to the db happens, session storage is purged
  3. When loading the editor and there is something different in session storage, a notice is shown to the user

@swissspidy
Copy link
Collaborator Author

@felipebochehin87
Copy link

Tested against PR #12129.

  1. Enabled auto save in Experiments
  2. Started a new story
  3. Didn't save changes
  4. Visited the Dashboard and reopened the story - message was displayed
  5. Clicked on Dismiss - unsaved changes were not loaded
  6. Made changes, didn't save them, visited the dashboard and reopened the Story - message was displayed
  7. Clicked on Restore Backup - changes were loaded
  8. Made other changes, saved, visited the dashboard and reopened the story - message was not displayed

popup.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Group: Editing Main editing features Group: Workspace A group encompassing all of workspace – everything inside the canvas and sidebar P2 Should do soon Status: Needs More Info Follow-up required in order to be actionable. Type: Enhancement New feature or improvement of an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants