Skip to content

[P2] Account panel logic duplicated between config.mjs and patreon-login-ui.mjs #4

Description

@digitsu

The hosted-mode account panel exists in two parallel implementations:

  • Class methods on PatreonLoginUI in scripts/patreon-login-ui.mjs_fetchQuota, _fetchRagStatus, _fetchSharedTierStatus, _refreshTier. Operate on this.quota / this.ragStatus / this.sharedTier / this._quotaFetchAttempted.
  • Module-level functions in scripts/config.mjs:1072-1188_handleRefreshTier, _fetchAccountData, _fetchRagStatus, _fetchSharedTierStatus. Operate on _accountPanelState (a shared mutable module-scope object).

The two implementations have:

  • Identical fetch logic, copy-pasted
  • The same bugs duplicated (silent-fetch swallowing, latch-never-resets)
  • Diverged conventions: one uses game.loremaster?.socketClient (post-8e3ea7f), the other still uses the stale game.modules.get('loremaster')?.api?.getSocketClient?.()

Why this is structural: every fix to the account panel has to land in both places, and the divergence in conventions means whoever fixes one almost certainly forgets the other. Several of the P1/P2 bugs filed alongside this issue all fan out from this duplication.

Suggested direction: extract a single account-panel.mjs (or similar) that owns the fetch state machine and exposes fetchAll() / refreshTier() / observable state. Both the inline settings panel and the standalone login dialog consume it. Refactor — file separately and tackle after the P1 bugs land in both copies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions