Skip to content

User preferences (theme, view mode, show empty) are lost when browser cache is cleared #18

Description

@rogercrocha

Problem

All user preferences set in the Settings modal — including theme, color mode (light/dark),
cellar view (cards/list/grid/table), and filter defaults — are stored exclusively in
localStorage. This means they are lost whenever the user clears browser cache or cookies,
or switches to a different browser/device.

This is particularly noticeable for multi-user setups, where each user expects their own
persistent preferences.

Context

This issue became apparent while working on PR #17, which adds a "Show out-of-stock wines"
persistent toggle. The toggle was implemented using localStorage following the same pattern
as the existing preferences — only to discover that the root problem is shared across all
settings.

Suggested solution

Implement a server-side user_preferences table in the SQLite database, keyed by username.
Add GET/POST endpoints (e.g. /api/preferences) to load and save preferences per user.
On page load, fetch preferences from the server and use them as the source of truth instead
of localStorage.

This would make all existing preferences (and future ones) truly persistent across browsers,
devices, and cache clears.

Affected preferences

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions