Skip to content

Conversation

ilsea
Copy link
Member

@ilsea ilsea commented Oct 16, 2026 •

  • Browse: books and search from the server, Load more with cursor pagination
  • Book detail: fetched by id, with loading, error and not-found states
  • Not done yet: shelf, rating and notes still use mock data (needs the x-user-id header)

Closes #66

Testing

The server needs MongoDB running and some seeded books, and the client defaults to localhost:3001.
Requires npm run dev in both /client and /server at the same time.

ilsea added 6 commits October 15, 2026 14:48
Add BOOKS_QUERY, replace mock books, search handled by server instead of via data/searchBooks.ts

New file:
- src/apollo/queries.tsx

Modified files:
- src/types/book.ts
- src/pages/BrowsePage.tsx
LoadingState.module.css and LoadingState.tsx used it's own styling for visually hidden elements. Now uses global style.
Paginate books with cursor (after/nextCursor).
Merge pages in the Apollo cache (client.ts)
Show ErrorState if loading more fails.
Hidden h2 above the grid to maintain heading hierarchy for accessibility.
Add query for a single book using its id
Swap mock books for real query and error/load states in BookDetailPage.tsx
Note: mockShelfEntries and ShelfEntry are still in use.
@ilsea ilsea requested a review from a team as a code owner October 16, 2026 07:55
@ilsea ilsea linked an issue Oct 16, 2026 that may be closed by this pull request
@ilsea ilsea closed this Oct 16, 2026
@ilsea ilsea reopened this Oct 16, 2026
Copy link
Member

@ronnenga ronnenga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works with local database. Good job

@ronnenga ronnenga merged commit 40e7b48 into main Oct 16, 2026
@ronnenga ronnenga deleted the 66-fetch-real-books-via-apollo-instead-of-mock-data branch October 16, 2026 10:11
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fetch real books via Apollo instead of mock data
2 participants