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
Experimental autosave feature for collections #6198
Conversation
Thanks for this! Is the change to package-lock.json necessary? If not, can we remove that from the PR please? |
This reverts commit d00af7a.
The commit is reverted. Is it possible to bring the changes for this to the master branch? |
I've brought master even with 3.3. |
Can you remind me what the use case is for needing autosave? Trying to think of what it might be but coming up a little short. Also, if you're using Revisions, I feel like it would make hundreds of working copies and kind of eliminate the usefulness of the features. 🤔 |
Personally, I do think that there are multiple pros. In general: You would need to enable autosave per collection, so it won't kick in unexpected. With autosave, you won't need to worry about saving your changes. That behaviour does work great for google docs.
A working copy might exist for a few days or weeks if making a change, preparing something for a later release etc. So having a working copy, which is a draft state, does make a lot of sense. Image that part with autosave: You could max loose changes from a few seconds to minutes, but not hours etc and you don't need to worry about it. This does offer a great fallback. Let's make autosave even more interesting and combine that with collaboration: With autosave, you are keeping the Browser and saved state via Collaboration in a pretty close sync, which does help avoid problems with too many state, if using collaboration heavily (to for example write articles). |
Sounds good 👍 The only real downside I can think of is that you'd be spamming EntrySaved/RevisionSaved events. But I don't know if that's really an issue. |
Yes we have thought about that too, so far we haven't noticed it as a problem. But we should keep an eye on it, that's why we wanted to bring it as an experimental feature for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This is looking and working great. Just some small changes that I can't seem to commit myself.
Can you please also add autosave
to the list on this line. (After assets
)
This will allow artisan vendor:publish --tag=statamic
to copy over the autosave.php
file.
Co-authored-by: Jason Varga <jason@pixelfear.com>
Co-authored-by: Jason Varga <jason@pixelfear.com>
Great, thanks for the review! :) Done: 13a0d17 |
This PR includes an autosave implementation for collections.
Via the autosave configuration the feature can be activated in general, but to make it work for a collection there are two ways to integrate this part. With
autosave: true
the interval time from the autosave configuration would be used, which means every 5000ms it is checked if an entry has a not saved state and save it. With egautosave: 8000
you can specify a time in which a change is to be checked.