Autosave
Status: ✅ Implemented — @AutoSave
Intent
Section titled “Intent”Eliminate the anxiety of losing work and the doubt of whether changes were persisted.
Problem
Section titled “Problem”A user fills out a long form, the session times out or the tab is accidentally closed, and everything is lost. Or they are left unsure whether the last “Save” actually went through. Both are correctability failures.
Solution
Section titled “Solution”Annotate the view class with @AutoSave. Mateu debounces field changes and automatically triggers the designated save action, keeping the backend in sync without any user gesture.
@UI("/orders/{id}/edit")@AutoSavepublic class EditOrder {
private String ref; private LocalDate date; private String notes;
public void save() { orderService.update(id, ref, date, notes); }}By default, @AutoSave targets the first eligible action on the class. You can specify the action explicitly:
@AutoSave(action = "save")How it works
Section titled “How it works”- Any field change triggers a debounce timer (default: ~800 ms).
- After the debounce window, the
saveaction fires automatically. - The action is local — it does not trigger navigation or page reload.
When to use it
Section titled “When to use it”Use @AutoSave | Use explicit Save button |
|---|---|
| Long editing sessions where data loss is costly | Workflows with a discrete “commit” concept |
| Drafts, notes, configuration | Multi-step wizards |
| Any field-by-field editing workflow | Destructive operations |
Principles served
Section titled “Principles served”- Recoverability — work is never lost to an accidental close or timeout
- Workflow over screens — saving becomes invisible infrastructure, not a user task
- Minimize navigation — no “save and stay” vs “save and go” decision required