- New notes: History, Artwork - Rewrite TMDB Integration: single detail request, entry mapper, rate limiter, refresh sync, stale-entry refresh, recommendations - Update pages, routing, API reference, models, database migrations, services, components, hooks, API clients, settings, media system, library, Electron (Tauri in progress) and known issues - Rewrite README for the current React/Express stack and setup
5.2 KiB
title, tags
| title | tags | |||
|---|---|---|---|---|
| Hooks |
|
Hooks
Custom hooks in react_frontend/src/hooks/. All query hooks wrap TanStack Query. All mutation hooks invalidate relevant caches and update Stores when applicable.
useEntries
[!info] File:
hooks/useEntries.ts
The main library hooks. Mutations update Stores optimistically.
| Hook | Type | Description |
|---|---|---|
useLibrary() |
Query | Fetch all entries → loads into Zustand store. Runs once on mount. |
useEntry(id) |
Query | Single entry by ID (triggers lazy refresh on backend) |
useEntrySeasons(id) |
Query | Seasons for an entry |
useCreateEntry() |
Mutation | POST /entries → adds to Zustand store |
useUpdateEntry() |
Mutation | PUT /entries/:id → updates Zustand store |
useDeleteEntry() |
Mutation | DELETE /entries/:id → removes from Zustand store |
useRefreshEntry() |
Mutation | PUT /entries/:id/refresh |
useUpdateEntryRatings() |
Mutation | PUT /entries/:id/ratings |
useUploadMedia() |
Mutation | POST /entries/:id/media |
useCollections
[!info] File:
hooks/useCollections.ts
| Hook | Type | Description |
|---|---|---|
useCollections() |
Query | All collections |
useCollection(id) |
Query | Single collection with entries |
useCreateCollection() |
Mutation | Create user collection |
useUpdateCollection() |
Mutation | Update collection (with media) |
useDeleteCollection() |
Mutation | Delete collection |
useAddEntryToCollection() |
Mutation | Add entry to collection |
useRemoveEntryFromCollection() |
Mutation | Remove entry from collection |
useSeasons
[!info] File:
hooks/useSeasons.ts
| Hook | Type | Description |
|---|---|---|
useSeason(id) |
Query | Season by ID (includes episodes) |
useSeasonEpisodes(id) |
Query | Episodes for a season |
useEntrySeen
[!info] File:
hooks/useEntrySeen.ts
See Watch Tracking.
| Hook | Type | Description |
|---|---|---|
useEntrySeenByEntry(entryId) |
Query | Watch records for an entry |
useCreateEntrySeen() |
Mutation | Create watch record |
useUpdateEntrySeen() |
Mutation | Update watch record |
useDeleteEntrySeen() |
Mutation | Delete watch record |
useEpisodeSeen
[!info] File:
hooks/useEpisodeSeen.ts
See Watch Tracking.
| Hook | Type | Description |
|---|---|---|
useEpisodeSeenByEpisode(episodeId) |
Query | Watch records for an episode |
useCreateEpisodeSeen() |
Mutation | Create episode watch record |
useUpdateEpisodeSeen() |
Mutation | Update episode watch record |
useDeleteEpisodeSeen() |
Mutation | Delete episode watch record |
usePeople
[!info] File:
hooks/usePeople.ts
| Hook | Type | Description |
|---|---|---|
usePerson(id) |
Query | Person by ID (lazy-fetch from TMDB) |
usePersonCredits(id) |
Query | Person's credits |
usePopularPeople(limit) |
Query | Popular people (local) |
useSearchPeople(query) |
Query | Search people (local) |
useTmdb
[!info] File:
hooks/useTmdb.ts
Infinite queries for TMDB browse/search pages. All return paginated results.
| Hook | Type | Description |
|---|---|---|
useTmdbTrending(type) |
Infinite Query | Trending movies/tv |
useTmdbPopular(type) |
Infinite Query | Popular movies/tv |
useTmdbTopRated(type) |
Infinite Query | Top-rated movies/tv |
useTmdbUpcoming() |
Infinite Query | Upcoming movies |
useTmdbSearch(query) |
Infinite Query | Multi-search |
useTmdbPopularPeople() |
Infinite Query | Popular people |
useTmdbSearchPeople(query) |
Infinite Query | People search |
useStatistics
[!info] File:
hooks/useStatistics.ts
See Statistics.
| Hook | Type | Description |
|---|---|---|
useAllTimeWatchTime() |
Query | Total watch time (all time) |
useYearlyWatchTime(year) |
Query | Watch time by month |
useYearlyWatchCount(year) |
Query | Watch count by month |
useWatchdayDistribution() |
Query | Day-of-week distribution |
useEpisodes
[!info] File:
hooks/useEpisodes.ts
| Hook | Type | Description |
|---|---|---|
useEpisodesByMonth(start, end) |
Query | Episodes airing in date range (for Calendar) |
useDiscoveryVideos
[!info] File:
hooks/useDiscoveryVideos.ts
See Discovery Videos.
| Hook | Type | Description |
|---|---|---|
useDiscoveryVideos() |
Infinite Query | Paginated video list (24/page) |
useUploadVideos() |
Mutation | POST /discovery-videos (multipart, upload progress) |
useUpdateVideo() |
Mutation | PUT /discovery-videos/:id |
useDeleteVideo() |
Mutation | DELETE /discovery-videos/:id |
useEntries — TMDB data additions
useEntryRecommendations(id)/useTmdbRecommendations(tmdbId, type)— "More like this"useArtwork({ entryId } | { tmdbId, type })/useAddArtwork(entryId)— ArtworkuseTmdbPreview(tmdbId, type)— also returns the entry-shapedentryused by the unified details page
useHistory
[!info] File:
hooks/useHistory.ts
useHistoryYears()—GET /history/yearsuseHistoryYear(year)—GET /history/:year
useDebounce
[!info] File:
hooks/useDebounce.ts
Utility hook: useDebounce(value, delay) — returns debounced value. Used by search inputs.