Skip to content

Renaming productName orphans localStorage (web-pane URL history, dir history) — userData dir moves #127

Description

@kordless

Summary

Updating to a build with a different productName flushes the web-pane URL list (and the directory history, the private-mode toggle, and anything else in localStorage). The data isn't deleted — it's orphaned in the old userData directory, because Electron derives userData from the app name, and we changed the app name across releases.

Root cause

  • web_pane_history is stored in localStorage (lib/components/url-picker.tsx), as is the dir history (lib/components/term.tsx DIR_HISTORY_KEY).
  • Electron's localStorage lives under app.getPath('userData'), which is derived from the app name (app.setName(...) / productName).
  • We changed the name: HyperiaHyperia2Hyperia-Terminal (app/index.ts, app/package.json productName). Each change points Electron at a new userData dir → fresh, empty localStorage → the list looks wiped.

Evidence (this machine, %APPDATA%)

userData dir Local Storage size origin
Hyperia 3 K 0.11.1
Hyperia2 82 K the Hyperia2 diagnostic builds (bulk of the history)
Hyperia-Terminal 16 K 0.12.7+

Three parallel localStorage stores; the running app only sees its own.

Impact

  • URL history, dir history, private-mode toggle, and any future localStorage-backed UI state are orphaned on every productName change.
  • The versioned AUMID (com.deepbluedynamics.hyperia-vXXXX) does not cause this — AUMID ≠ userData path. It's specifically productName/app.name.

Fix directions (pick one; (1) also immunizes against future renames)

  1. Pin a stable userData path independent of the display name — early in app/index.ts, before windows are created:
    app.setPath('userData', path.join(app.getPath('appData'), 'Hyperia'));
    The display name can then change freely without ever moving the data dir.
  2. One-time migration on first run: if the current userData localStorage is empty and an older dir (Hyperia2/Hyperia) has data, copy Local Storage/IndexedDB over.
  3. Move URL/dir history out of localStorage into ~/.hyperia/ (path-stable, like the sidecar config), so it's decoupled from Electron's userData entirely.

Recovery (current users)

Data is recoverable — copy %APPDATA%/Hyperia2/Local Storage into %APPDATA%/Hyperia-Terminal/Local Storage (app closed), or implement fix (2).

Environment

  • Windows 11; app renamed Hyperia → Hyperia-Terminal across 0.11.1 → 0.12.9.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions