Patterns
Save edits and recover from failure
Keep the edit draft, busy state and successful persistence evidence distinct.
On this page
Workflow
| Step | Responsibility |
|---|---|
| 1 | Keep local edits in the current owner form. |
| 2 | Commit with the actual route’s callback. |
| 3 | Disable duplicate saves while pending. |
| 4 | Set lastSaved only on confirmed success. |
| 5 | On failure, retain the draft and offer clear retry. |
Decisions and composition
- SaveButton has external and local busy state.
- The standalone auto-save helper debounces by 1500ms; do not assume every route uses it.
- Server authorization and validation remain required for every mutation.
Errors, recovery and limits
- Rejected onClick can leave SaveButton locally busy without finally.
- Auto-save failure currently logs errors instead of exposing them to the user.
- FeedbackForm shows Thanks without checking res.ok.
- Simulated saved timestamps in specimens are not live persistence evidence.
Source references
| File | Responsibility |
|---|---|
| src/components/SaveButton.tsx | Busy/timestamp |
| src/hooks/useAutoSaveCourse.ts | Debounce |
| src/components/FeedbackForm.tsx | Acknowledgement gap |
Examples from the app
Actual TeachKit UI with Thomas McGee’s course content. Session, progress and connection specimens are simulated; no student data or live changes. Captured at 2× resolution or higher. Select an image to inspect it full size.
Related topics
Source audit: 2026-10-07 · Revision d8cf23d0a329 · Documentation v0.1