Skip to content

refactor(sync): batch untracked board graduation via MARK_BOARDS_SYNCED#2212

Merged
tomivm merged 1 commit into
masterfrom
refactor/addSyncMetaStatus
Jun 5, 2026
Merged

refactor(sync): batch untracked board graduation via MARK_BOARDS_SYNCED#2212
tomivm merged 1 commit into
masterfrom
refactor/addSyncMetaStatus

Conversation

@RodriSanchez1

Copy link
Copy Markdown
Collaborator

What

Replaces the per-board dispatch(updateBoard(b, true)) used to graduate untracked boards in Pass 2 of classifyBoardsForPush with a single batched MARK_BOARDS_SYNCED action.

Closes #2211

Why

Graduation onboards an untracked board into the sync system when a same-ID remote board exists with an equal-or-newer lastEdited. The board's data never changes — the only meaningful effect is setting syncMeta[id].status = SYNCED.

Using UPDATE_BOARD for this was wasteful:

  • rewrites the boards array (splice) once per board,
  • recomputes lastEdited (to the same value),
  • dispatches one action per board → N reducer passes.

Changes

  • Board.constants.js — new MARK_BOARDS_SYNCED action type.
  • Board.actions.js — new markBoardsSynced(boardIds) action creator. Pass 2 now collects graduated IDs into boardsToGraduate and dispatches a single markBoardsSynced(...) before returning (dispatch kept inside classifyBoardsForPush).
  • Board.reducer.js — new MARK_BOARDS_SYNCED case that batch-sets status: SYNCED for all IDs in one reducer pass (same pattern as ADD_BOARDS) and leaves the boards array untouched.
  • docs/sync-engine.md — updated the graduation logic (§7) and the syncMeta lifecycle table (§10.2).
  • Board.actions.test.js — updated the graduation test to assert the batched MARK_BOARDS_SYNCED action.

Scope note

Graduation of untracked boards happens only in Pass 2. The other updateBoard(_, true) calls in the PULL phase (applyRemoteChangesToState) are genuine data updates from remote and keep using UPDATE_BOARD.

Testing

Board.actions.test.js and Board.reducer.test.js — 137 tests passing.

🤖 Generated with Claude Code

Untracked-board graduation in Pass 2 of classifyBoardsForPush previously
dispatched updateBoard(board, true) per board, which rewrites the boards
array and recomputes lastEdited on every graduation even though the board
data never changes.

Introduce a dedicated MARK_BOARDS_SYNCED action that batches all graduated
board IDs into a single dispatch/reducer pass, only flipping
syncMeta[id].status to SYNCED without touching the boards array.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@RodriSanchez1 RodriSanchez1 requested a review from tomivm June 4, 2026 00:37
@RodriSanchez1 RodriSanchez1 self-assigned this Jun 4, 2026
@RodriSanchez1 RodriSanchez1 requested a review from magush27 June 4, 2026 00:53
@tomivm tomivm merged commit 0d3cf20 into master Jun 5, 2026
5 checks passed
@tomivm tomivm deleted the refactor/addSyncMetaStatus branch June 5, 2026 17:19
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.

Batch untracked board graduation instead of per-board updateBoard dispatch

2 participants