Skip to content

Load board from DB before first render#4

Merged
snktshrma merged 1 commit into
mainfrom
cursor/remove-board-flash-52d7
Jun 16, 2026
Merged

Load board from DB before first render#4
snktshrma merged 1 commit into
mainfrom
cursor/remove-board-flash-52d7

Conversation

@snktshrma

Copy link
Copy Markdown
Member

Summary

Removes the sample-data flash on refresh when running with python server.py. The UI now loads from the database first, then renders once.

Changes

  • DATA starts empty; no synchronous renderAll() on boot
  • startBoardSync fetches GET /api/board, applies the payload, then calls renderAll() once
  • Sample tasks extracted to src/data/sample-tasks.js and used only when the API is unreachable (npx serve static mode)
  • Added tests/board-sync.test.js for load/fallback boot behavior

Before / after

  • Before: built-in sample Gantt paints immediately, then swaps to DB data ~100ms later
  • After: brief empty state while fetching, then DB data appears in a single paint (no swap)

Test plan

  • npm test passes (26 tests)
  • python server.py - refresh shows DB tasks with no sample-data flash
  • npx serve . - still shows demo tasks when no API is available
Open in Web Open in Cursor 

Start with empty in-memory DATA, fetch /api/board, then render once.
Sample tasks moved to sample-tasks.js for static-only fallback.

Co-authored-by: Sanket Sharma <sharma.sanket272@gmail.com>
@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-06-16 15:09 UTC

@snktshrma snktshrma merged commit c017e25 into main Jun 16, 2026
2 checks passed
cursor Bot pushed a commit that referenced this pull request Jun 16, 2026
Resolve CHANGELOG conflict after PR #4 (DB-first load) merged to main.

Co-authored-by: Sanket Sharma <sharma.sanket272@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.

2 participants