Skip to content

Autosave puts work-in-progress edits live when working on already published entries #10516

@steveparks

Description

@steveparks

Bug description

If an editor is working on edits to an entry that is published, Autosave puts the partial updates live in 5 second chunks while the editor works.

Because of the way that the experimental Autosave functionality works, edits to entries that are already published will be autosaved over the top of the existing file that Statamic is also reading to serve the live page. That means that edits in progress will be published live before the editor realises.

I think there are three approaches to address this, which could be combined:

  1. Disable autosave on posts that are already published. This is the easiest, but should also warn the editor that autosave isn't running for that reason. This could also be an override-able option in autosave.php.

  2. Autosave could only function on published posts if Revisions are being used, and makes its changes to the working copy.

  3. Some other way of autosave keeping its work-in-progress away from the live file in a temporary file like Revisions does

I'm aware that Autosave is an experimental feature, and am up for testing and troubleshooting to refine it.

How to reproduce

  1. Enable autosave in /config/statamic/autosave,php
  2. Enable autosave on a collection as described in autosave.php
  3. Create an entry in that collection, and save it manually
  4. View that entry on the website in another browser tab
  5. Now go back and edit the entry, waiting enough time for autosave to happen. Don't press manual save!
  6. refresh the browser tab with the website display of the page and see your partial updates live

Logs

No response

Environment

Environment
Application Name: Convivio
Laravel Version: 11.17.0
PHP Version: 8.3.9
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: convivio.test
Maintenance Mode: OFF
Timezone: Europe/London
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Livewire
Livewire: v3.5.4

Statamic
Addons: 11
Sites: 1
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.17.0 PRO

Statamic Addons
goldnead/statamic-toc: 1.5
jonassiewertsen/statamic-livewire: 3.6.0
mitydigital/feedamic: 2.4.1
statamic/wikilinks: 2.1.0
stillat/relationships: 2.2.1
studio1902/statamic-peak-browser-appearance: 3.5.0
studio1902/statamic-peak-commands: 8.4.0
studio1902/statamic-peak-seo: 8.15.3
studio1902/statamic-peak-tools: 6.3.0
tv2regionerne/statamic-passport: 1.4.1
tv2regionerne/statamic-private-api: 1.15.0

Installation

Existing Laravel app

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions