Skip to content

[6.x] Render provisional drafts and autosave in the Inertia editor - #19396

Closed
brianjhanson wants to merge 1 commit into
feature/inertia-edit-multi-sitefrom
feature/inertia-edit-drafts
Closed

[6.x] Render provisional drafts and autosave in the Inertia editor#19396
brianjhanson wants to merge 1 commit into
feature/inertia-edit-multi-sitefrom
feature/inertia-edit-drafts

Conversation

@brianjhanson

@brianjhanson brianjhanson commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Description

Renders provisional drafts in the Inertia editor and autosaves into them, which is what makes the port usable: the legacy editor creates a provisional draft the moment anyone types, so before this every previously-edited entry fell through to the old screen.

EditEntryController now only defers to EditElementController for named drafts and revisions. Provisional drafts render here, with a notice and a Discard control, and saveUrl/applyDraftUrl let the client pick its target at submit time — autosave can create a draft partway through editing a canonical element, and from that point saving means applying the draft rather than saving the element underneath it.

useElementAutosave posts to the shared elements/save-draft action, debounced and serialized so a burst of typing collapses into one trailing request. It is driven by the Form renderers' change callbacks rather than a watch on the Inertia form, because the form starts empty and gains its keys dynamically. Re-baselining after a save is suspended so it can't recreate the draft the save just consumed, and the draft id resyncs from the server after each visit. With edits safe in a draft, the unsaved-changes prompt now only fires when autosave hasn't caught up.

Also fixes a save-blocking bug from the meta-fields PR: the DateTime control defaults to a 30-minute increment, so an entry whose post time fell between steps failed native form validation and the Save button silently did nothing. The legacy editor never hit this because it submits through JS. Post and expiry dates now accept the stored precision.

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

📚 Storybook previews

@craftcms/uiopen Storybook

No changed components detected in this Storybook.

resources/js⚠️ deploy failure, no preview available

@brianjhanson brianjhanson changed the title Render provisional drafts and autosave in the Inertia editor [6.x] Render provisional drafts and autosave in the Inertia editor Aug 11, 2026
@brianjhanson
brianjhanson force-pushed the feature/inertia-edit-drafts branch from c68db72 to d6007bb Compare August 11, 2026 19:56
@brianjhanson
brianjhanson force-pushed the feature/inertia-edit-drafts branch from d6007bb to 3960578 Compare August 12, 2026 14:53
@brianjhanson
brianjhanson force-pushed the feature/inertia-edit-drafts branch from 3960578 to 56e578e Compare August 12, 2026 16:14
@brianjhanson
brianjhanson marked this pull request as ready for review August 12, 2026 16:19
@brianjhanson

Copy link
Copy Markdown
Contributor Author

Superseded by #19425, which flattens this stack into a single PR against 6.x — this PR is one of its commits, description and all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant