Skip to content

Save Draft / restore flow for Create Contest page#14371

Merged
dylanjeffers merged 1 commit into
mainfrom
feat/draft-contest
May 22, 2026
Merged

Save Draft / restore flow for Create Contest page#14371
dylanjeffers merged 1 commit into
mainfrom
feat/draft-contest

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

  • New `useContestDraft` hook persists in-progress Create Contest form state to localStorage, scoped per user + primary track (or "trackless" for the `/host-contest` entry).
  • Hooked the Create Contest page up to the draft store: Save Draft button, restore banner offering to reload an unsaved draft, and a debounced auto-save (1.5s after editing pauses).
  • Edit mode is unaffected — drafts are create-only since the live event is the source of truth there.

Test plan

  • Open `/host-contest`, type into the form, refresh — banner offers to restore the draft.
  • Click Restore — fields repopulate, banner disappears.
  • Click Discard — draft is wiped, refresh shows a clean form with no banner.
  • Click Save Draft — button label flips to "Draft saved".
  • Leave the form alone for ~2s after typing — draft is auto-saved (verify via `localStorage.getItem('audius:contest-draft::trackless')`).
  • From a track page `/:handle/:slug/host-contest`, draft is scoped per track (different key, doesn't leak across contests).
  • Launch a contest — draft is cleared, navigating back to the host page no longer shows the banner.
  • Open the host-contest page in edit mode for a live contest — no Save Draft button, no banner.

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 21, 2026

⚠️ No Changeset found

Latest commit: d99388e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Host Remix Contest's create flow now has a working draft path so users
can step away mid-form without losing their work:

- New useContestDraft hook persists the full form (title, description,
  video URL, cover photo URL, prizes, deadline date/time, source track
  ids) to localStorage, scoped per user and per contest scope (the
  primary track or "trackless" for the /host-contest entry).
- Save Draft button manually saves the in-flight form, and a draft-
  restore Hint appears at the top of the page on load when a saved
  draft is present, with Restore Draft / Discard actions.
- Debounced auto-save persists the draft 1.5s after the user stops
  editing — skipped while the restore banner is up (so we don't
  clobber the existing draft before the user decides) and when the
  form is empty (so Discard actually means discarded).
- Drafts auto-clear on launch / cancel / delete — the contest is
  live, so the local snapshot would just shadow stale fields.
- Edit mode is unchanged: the live event is the source of truth, so
  the draft hook is disabled and the Save Draft button is hidden.

No backend changes — drafts live entirely in the browser.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14371.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

@dylanjeffers dylanjeffers merged commit 02e7aa0 into main May 22, 2026
13 checks passed
@dylanjeffers dylanjeffers deleted the feat/draft-contest branch May 22, 2026 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant