Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion hooks/useLibraryData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ export function useLibraryData(initialFilters?: Partial<LibraryFilters>) {
const service = useMemo(() => libraryService, []);

// Create a stable query key based on filter values (excluding pagination.skip)
// Use queryKeys.library.books() as base to ensure consistency with refresh/invalidation
const queryKey = useMemo(() => [
'library-books',
...queryKeys.library.books(),
filters.status,
filters.search,
filters.tags,
Expand Down
6 changes: 6 additions & 0 deletions hooks/usePullToRefreshLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export function usePullToRefreshLogic() {

if (queryKey) {
await queryClient.invalidateQueries({ queryKey });
} else if (pathname === "/journal") {
// Special case: Invalidate both journal entries and archive using prefix matching
await Promise.all([
queryClient.invalidateQueries({ queryKey: ['journal-entries'] }),
queryClient.invalidateQueries({ queryKey: ['journal-archive'] }),
]);
Comment thread
masonfox marked this conversation as resolved.
} else {
// Fallback: invalidate all queries if we don't have specific keys
await queryClient.invalidateQueries();
Comment thread
masonfox marked this conversation as resolved.
Expand Down
2 changes: 1 addition & 1 deletion hooks/useShelfBooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function useShelfBooks(
? queryKeys.shelf.detail(shelfId, { orderBy, direction })
: ['shelf-empty'],
queryFn: async () => {
if (!shelfId) return null;
if (shelfId === null) return null;

Comment thread
masonfox marked this conversation as resolved.
const shelf = await shelfApi.get(shelfId, {
withBooks: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/usePageTitle.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useLayoutEffect, useRef, useEffect } from "react";
import { useLayoutEffect, useEffect } from "react";

/**
* Custom hook to set the page title
Expand Down
Loading