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

Prevent losing data when the page is closed #4

Open
darekkay opened this issue Apr 15, 2020 · 0 comments
Open

Prevent losing data when the page is closed #4

darekkay opened this issue Apr 15, 2020 · 0 comments
Labels
Type: Enhancement New feature or request

Comments

@darekkay
Copy link
Owner

User data is being stored in the local storage using redux-persist.
If the user enters some data (e.g. within the Text widget) and immediately closes the page, the data might not be saved.

One solution is to explicitly persist the store by listening to the beforeunload event. This depends on whether this action can be executed reliably for all supported browsers.

An alternative is to display a warning message when a page is being closed (using the same beforeunload event) as long as there are unpersisted changes (similar to what Todoist is doing).

In the future, the user account feature is likely to be implemented, making it necessary to store the data on the server. Hence, using something like sendBeacon might be required.

@darekkay darekkay added the Type: Enhancement New feature or request label Apr 15, 2020
@darekkay darekkay changed the title Display a warning for unsaved data Prevent losing data on page close Apr 15, 2020
@darekkay darekkay changed the title Prevent losing data on page close Prevent losing data when the page is closed Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant