Skip to content

fix: persist create-stream form draft to sessionStorage across page reloads (Closes #1087) - #1153

Merged
ogazboiz merged 3 commits into
LabsCrypt:mainfrom
sojetunde8:fix/issue-1087-session-storage-draft
Aug 6, 2026
Merged

fix: persist create-stream form draft to sessionStorage across page reloads (Closes #1087)#1153
ogazboiz merged 3 commits into
LabsCrypt:mainfrom
sojetunde8:fix/issue-1087-session-storage-draft

Conversation

@sojetunde8

Copy link
Copy Markdown
Contributor

Closes #1087

Summary

  • Persist multi-step wizard form state to sessionStorage on each change (debounced 500ms) to survive accidental page reloads
  • Restore the saved draft on remount with a visible "resumed draft" banner and a "Discard Draft" affordance
  • Clear the draft on successful on-chain submission or explicit discard; keep it across normal navigation so the user can return
  • Guard recipient deep-link prefill so it doesn't overwrite a restored draft

Testing

  • Added unit test suite covering: saving form data on change, restoring draft on mount, banner visibility, discard flow, draft-vs-query-param precedence, and empty-draft edge case
  • Verified with existing test patterns and conventions

@ogazboiz ogazboiz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice feature and the seven tests (including draft vs query-param precedence) are solid. three fixes needed:

  1. the debounced save fires 500ms after mount even on a pristine form, writing an empty draft that loadDraftFromSession happily accepts, so the next visit shows a bogus "Resumed a saved draft" banner over an empty form. skip saving when the form equals defaults, or reject empty drafts on load.
  2. the banner calls loadDraftFromSession() on every render just to read savedAt. capture it once in state.
  3. revert the "Back to Dashboard" Link to a Link. the button plus router.push swap does not protect the draft (Link navigation would not clear sessionStorage either) and regresses semantics.

if you want to keep contributing, join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0

@sojetunde8

Copy link
Copy Markdown
Contributor Author

Resolved, Chief. @ogazboiz

@ogazboiz
ogazboiz merged commit e12b8a7 into LabsCrypt:main Aug 6, 2026
10 checks 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.

[Frontend] create-stream-content.tsx does not persist form draft across accidental page reloads

3 participants