feat: Move board configuration data to backend and expose via GraphQL#479
feat: Move board configuration data to backend and expose via GraphQL#479marcodejongh wants to merge 3 commits intomainfrom
Conversation
This reduces client bundle size by moving large configuration data (~260KB) to the backend and making it available via GraphQL queries. Changes: - Add board configuration data module to backend (packages/backend/src/data/) - product-sizes-data.ts: Product sizes, layouts, sets, image filenames, hole placements - led-placements-data.ts: LED position mappings for Bluetooth control - board-data.ts: Static board dimensions, angles, and grades - types.ts: TypeScript type definitions - index.ts: Module exports - Add GraphQL types and queries for board configuration - ProductSize, Layout, HoldSet, BoardDetails, LedPlacements types - boardDetails, layouts, sizesForLayout, setsForLayoutAndSize queries - ledPlacements query for Bluetooth LED control - boardSelectorOptions query for setup wizard - Update Bluetooth components to fetch LED placements via GraphQL - use-board-bluetooth.ts: Async fetch with caching - send-climb-to-board-button.tsx: Async fetch with caching - Add server-side cached GraphQL operations for board config - board-config.ts: Server-only cached queries - board-config.client.ts: Client-side fetcher for LED placements This is the first phase of the migration. Server components still use the bundled data files; future work will update them to use GraphQL.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Claude Review
|
- Extract duplicated convertToMirroredFramesString to bluetooth-utils.ts - Create shared createLedPlacementsFetcher factory for cached LED fetching - Update use-board-bluetooth.ts and send-climb-to-board-button.tsx to use shared utilities - Add error logging to empty catch block in boardDetails resolver
Claude ReviewIssues Found:
|
- Deduplicate handleClick to reuse sendClimbToBoard callback - Add user notification (message.error) when LED placements fetch fails - Add comprehensive input validation for GraphQL resolvers: - LayoutIdSchema for layout_id validation - SizeIdSchema for size_id validation - SetIdsArraySchema for set_ids array validation - Import shared types from @boardsesh/shared-schema to reduce duplication - BoardName, HoldTuple, HoldRenderData, ImageFileName, ImagesToHolds
Claude Reviewpackages/web/app/components/board-bluetooth-control/send-climb-to-board-button.tsx:162-167
packages/web/app/components/board-bluetooth-control/bluetooth-utils.ts:43-66
packages/web/app/lib/graphql/operations/board-config.client.ts:38-40
packages/backend/src/graphql/resolvers/board/queries.ts:131-134
packages/backend/src/data/product-sizes-data.ts & led-placements-data.ts
|
This reduces client bundle size by moving large configuration data (~260KB)
to the backend and making it available via GraphQL queries.
Changes:
Add board configuration data module to backend (packages/backend/src/data/)
Add GraphQL types and queries for board configuration
Update Bluetooth components to fetch LED placements via GraphQL
Add server-side cached GraphQL operations for board config
This is the first phase of the migration. Server components still use
the bundled data files; future work will update them to use GraphQL.