Skip to content

Preserve routine drafts across app navigation - #82

Merged
rd-code-23 merged 1 commit into
feature/routines-folder-organizationfrom
feature/persist-routine-draft-navigation
Aug 30, 2026
Merged

rd-code-23 merged 1 commit into
feature/routines-folder-organizationfrom
feature/persist-routine-draft-navigation

Conversation

@rd-code-23

Copy link
Copy Markdown
Owner

Summary

Preserves an unfinished routine draft when the user navigates to another page inside the authenticated app. The draft is now cleared only when the user chooses Clear or leaves the application session.

Behavior

  • moves RoutineDraftFormProvider from the routine-creation route group to the authenticated _app layout
  • keeps the same React Hook Form instance alive across Dashboard, History, Routines, and the routine-creation pages
  • adds a Clear button that resets the field value and all RHF validation state together
  • removes the unused Preview button
  • does not persist the draft through a full browser refresh or closed tab

Why React Hook Form remains the owner

Moving the provider higher extends the lifetime of the existing form without copying values or errors into Zustand. This keeps one source of truth for routine-level form state.

Tests

  • verifies Clear removes both the routine name and its validation error
  • verifies an invalid draft and visible error survive a visit to History
  • verifies Preview is no longer rendered
  • all 39 web tests pass

Dependency

This PR is stacked on PR #81 because it uses the reorganized routine feature paths. Once #81 merges, this PR can be rebased or retargeted to main.

@rd-code-23
rd-code-23 merged commit 09c9fe5 into feature/routines-folder-organization Aug 30, 2026
1 check passed
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