Skip to content

docs: add doc comments to use-form-draft hook (#782) - #867

Merged
Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
paul-motron:docs/782-use-form-draft-doc-comments
Sep 26, 2026
Merged

Austinaminu2 merged 1 commit into
FlowwStar:mainfrom
paul-motron:docs/782-use-form-draft-doc-comments

Conversation

@paul-motron

Copy link
Copy Markdown
Contributor

Closes #782

Summary

Adds doc comments to both exports in hooks/use-form-draft.ts, plus its internal constants and types.

  • useFormDraft: the draft-save contract. It covers the 500ms debounce, the flowstar_draft_<key> storage key, the 24h TTL, how restore() skips the auto-save it would otherwise trigger, and what enabled = false does and doesn't turn off.
  • The silent-failure behavior from Surface use-form-draft.ts's silent save failures to the user #676: a failed save drops that draft, and onSaveError fires once per failure streak and is re-armed after the next successful save. Without onSaveError, failures stay silent.
  • Two caller notes: onSaveError should be memoized, and discard() doesn't catch storage errors the way the other methods do.
  • clearExpiredDrafts: what it removes, that it swallows errors, and that it's meant to run once on mount (as create-form.tsx does).

Testing

Comments only. No runtime changes.

@drips-wave

drips-wave Bot commented Sep 25, 2026

Copy link
Copy Markdown

@paul-motron Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Austinaminu2
Austinaminu2 merged commit 92d0d50 into FlowwStar:main Sep 26, 2026
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.

Add doc comments to hooks/use-form-draft.ts

2 participants