Skip to content

Persist editor state in localStorage across reloads #3

Description

@MrBeldum

Goal

Remember the last username, message, color, and selected built-in badges when the page reloads, so a refresh does not wipe in-progress work.

Scope

  • On meaningful state changes, save a small JSON blob to localStorage (version the key, e.g. tmc-state-v1).
  • On load, restore username, message, color (via parseHexColor), and selected built-in badge IDs that still exist in BADGES.
  • Reset should clear persisted state as well as the UI.
  • Fail soft: corrupt/missing storage must fall back to current defaults without breaking the page.

Out of scope

  • Persisting custom badge image data URLs (can be large; skip or document as follow-up).
  • Syncing across tabs beyond a simple reload restore.
  • New dependencies or frameworks.

Acceptance

  • Reload restores the last valid username/message/color/built-in badges.
  • Reset clears storage and returns to defaults.
  • Invalid stored color is ignored (defaults apply).
  • node --test still passes; manual check via ./start-local.sh.

Please comment here before starting if you want to claim this.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions