Skip to content

feat(favorites): add per-user favorite pages#1310

Merged
perber merged 1 commit into
mainfrom
feature/favorites
Jul 14, 2026
Merged

feat(favorites): add per-user favorite pages#1310
perber merged 1 commit into
mainfrom
feature/favorites

Conversation

@perber

@perber perber commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Adds a private, per-user favorites list, separate from the global editorial "Pinned Pages" flag: any authenticated user (not just editor/admin) can favorite/unfavorite any page they can read.

Backend: new internal/favorites package (own favorites.db, outside resync's reach per ADR-0001), AddFavorite/RemoveFavorite/ListFavorites use cases, PUT/DELETE /api/pages/:id/favorite and GET /api/favorites routes, cascade cleanup on page delete and user delete.

Frontend: stores/favorites.ts (optimistic add/remove), star toggle on tree rows and the page viewer header, new "Favorites" sidebar accordion section between Pinned and Pages, loaded/cleared reactively off the session user id in App.tsx.

Adds a private, per-user favorites list, separate from the global
editorial "Pinned Pages" flag: any authenticated user (not just
editor/admin) can favorite/unfavorite any page they can read.

Backend: new internal/favorites package (own favorites.db, outside
resync's reach per ADR-0001), AddFavorite/RemoveFavorite/ListFavorites
use cases, PUT/DELETE /api/pages/:id/favorite and GET /api/favorites
routes, cascade cleanup on page delete and user delete.

Frontend: stores/favorites.ts (optimistic add/remove), star toggle on
tree rows and the page viewer header, new "Favorites" sidebar
accordion section between Pinned and Pages, loaded/cleared reactively
off the session user id in App.tsx.
@perber
perber merged commit 223384b into main Jul 14, 2026
9 checks passed
@perber
perber deleted the feature/favorites branch July 14, 2026 13:45
mrchypark added a commit to mrchypark/leafwiki that referenced this pull request Jul 15, 2026
* feat(editor): make preview split resizable (perber#1279)

* feat(tree): drag & drop page/section reordering in the page tree (perber#1307)

Reorder and move pages/sections directly in the sidebar tree by dragging
rows: drop between rows to reorder (insertion indicator), drop onto a
section to move into it (auto-expands collapsed sections on hover), with
optimistic updates and a silent tree re-sync. Same-parent reorders use the
existing sort endpoint; cross-parent drops use the move endpoint, which now
accepts an optional position for atomic move+placement (MoveNodeToPosition;
omitted position appends, so existing callers are unchanged).

Also folds in two fixes surfaced while testing the feature:
- Firefox performed a full page navigation on drop because the post-drag
  click bypasses React's synthetic handlers; click suppression is now a
  native window-level capture listener armed during the drag.
- MarkdownPreview re-parsed and re-rendered the whole article on every
  tree store update (byId identity churn); the rendered markdown element
  is now memoized on the resolved content string.

Fixes perber#1110

* feat(favorites): add per-user favorite pages (perber#1310)

Adds a private, per-user favorites list, separate from the global
editorial "Pinned Pages" flag: any authenticated user (not just
editor/admin) can favorite/unfavorite any page they can read.

Backend: new internal/favorites package (own favorites.db, outside
resync's reach per ADR-0001), AddFavorite/RemoveFavorite/ListFavorites
use cases, PUT/DELETE /api/pages/:id/favorite and GET /api/favorites
routes, cascade cleanup on page delete and user delete.

Frontend: stores/favorites.ts (optimistic add/remove), star toggle on
tree rows and the page viewer header, new "Favorites" sidebar
accordion section between Pinned and Pages, loaded/cleared reactively
off the session user id in App.tsx.

* refactor(sqliteutil): share open/corruption-recovery logic across stores (perber#1311)

Extract the "open → ensure schema → on recoverable SQLite corruption,
wipe and retry once" sequence, previously copy-pasted near-verbatim in
tags, links, properties, and search's store constructors, into a single
sqliteutil.RetryOnCorruption helper. Each store keeps its own opening
mechanics (eager sql.Open, links' lazy Connect(), search's fully lazy
withDB); only the recovery policy is now shared.

* feat(preview): add AutoHotkey syntax highlighting (perber#1312)

Co-authored-by: Chen Zhang <c436zhan@gmail.com>

* test(e2e): stabilize CodeMirror replace flow

* fix: address upstream sync review findings

* fix: guard favorite snapshot visibility

---------

Co-authored-by: Abu Hossain Foysal <ahfoysal30@gmail.com>
Co-authored-by: Aurelio Arcabascio <140868181+arcabaa@users.noreply.github.com>
Co-authored-by: perber <patrick.erber@gmail.com>
Co-authored-by: c436zhan <zc19970919@gmail.com>
Co-authored-by: Chen Zhang <c436zhan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant