Skip to content

⚡️ Feat: add persistence to notes store#2

Open
gndx wants to merge 1 commit intomainfrom
enhancement/notes-store-persistence
Open

⚡️ Feat: add persistence to notes store#2
gndx wants to merge 1 commit intomainfrom
enhancement/notes-store-persistence

Conversation

@gndx
Copy link
Collaborator

@gndx gndx commented Jan 7, 2026

Summary

This PR adds persistence to the notes store by introducing a new createPersistentNotesStore implementation that automatically synchronizes notes with localStorage.

Changes

  • Added a persistent notes store that loads initial state from storage.
  • Persisted notes on create, update, and delete operations.
  • Preserved the existing store API (CRUD, search, ordering, favorites, count).
  • Ensured state encapsulation using closures and defensive copies.
  • Automatically derived title and excerpt when note content changes.

Motivation

Persisting notes allows the application to retain user data across browser sessions without requiring a backend or external dependencies, improving user experience and reliability.

Impact

  • No breaking changes to the public API.
  • Existing consumers can adopt persistence by switching to the new store factory.

Notes

  • Persistence is implemented using localStorage.
  • Storage is updated immediately after every state mutation.

@gndx gndx requested a review from felipesolem January 7, 2026 17:30
@gndx gndx self-assigned this Jan 7, 2026
@gndx gndx added the enhancement New feature or request label Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant