Skip to content

Persist user selections to JSON config file #4

@akuligowski9

Description

@akuligowski9

Summary

Discipline and source selections are stored in the session, which expires after 120 minutes of inactivity. Returning users must re-select everything. Persist selections to a local JSON file so they survive across sessions.

Context

The app already uses JSON file persistence for saved papers (SavedPapersRepository writes to storage/app/saved-papers.json). The same pattern can be applied to user selections.

What to do

  1. Create a UserPreferencesRepository service (similar pattern to SavedPapersRepository)
  2. Store to storage/app/user-preferences.json
  3. Save: enabled disciplines + enabled sources per discipline
  4. Load preferences on app boot (or on mount of DisciplinePicker/SourcePicker)
  5. Keep session as the primary store during a session, but sync to JSON on save
  6. On session expiry, restore from JSON file

Files to modify/create

  • app/Services/UserPreferencesRepository.php (new)
  • app/Livewire/DisciplinePicker.php (load/save)
  • app/Livewire/SourcePicker.php (load/save)
  • tests/Unit/UserPreferencesRepositoryTest.php (new)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions