Problem/Motivation

Both reset paths (CanvasResetConfirmForm::submitForm() and the HTMX endpoint CanvasResetController::reset()) empty field_canvas_layout and save, but:

  • They never call Canvas's AutoSaveManager::delete(). A pending Canvas auto-save is a full snapshot of the node including the old layout — it stays listed in /canvas/api/v0/auto-saves/pending, and publishing it later silently restores the layout that was just reset.
  • They never call setNewRevision(), so on revisionable content the reset overwrites the current default revision in place: no revision trail, no way to see what was removed, even though every normal node save creates a revision.

Steps to reproduce

  • Enable canvas_override on a type, edit a node's layout in the Canvas editor (creating an auto-save) but do not publish.
  • Reset the layout from the Reset Canvas layout tab.
  • Open the Canvas review panel and publish the still-pending change: the "reset" layout comes back.

Proposed resolution

After saving the emptied field, call AutoSaveManager::delete($node) in both reset paths, and save the reset as a new revision with a revision log message, revision user and timestamp.

Remaining tasks

  • ✅ File an issue about this project
  • ✅ Addition/Change/Update/Fix to this project
  • ✅ Testing to ensure no regression
  • ✅ Automated unit/functional testing coverage
  • ➖ Developer Documentation support on feature change/addition
  • ➖ User Guide Documentation support on feature change/addition
  • ➖ UX/UI designer responsibilities
  • ➖ Accessibility and Readability
  • ✅ Reviewed by a human
  • ✅ Code review by maintainers
  • ✅ Full testing and approval
  • ✅ Credit contributors
  • ✅ Review with the product owner
  • ✅ Update Release Notes
  • ✅ Release canvas_override-1.0.0

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Resetting a per-content layout now removes any pending Canvas auto-save (so it cannot be re-published) and records the reset as a new node revision.
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

rajab natshah created an issue. See original summary.

rajab natshah’s picture

Issue summary: View changes
Status: Active » Needs review

  • rajab natshah committed 9ac7614e on 1.0.x
    fix: #3621488 Delete the pending Canvas auto-save and create a new...
rajab natshah’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

rajab natshah’s picture

Issue summary: View changes
rajab natshah’s picture

Issue summary: View changes
Issue tags: +canvas_override-1.0.0