fix: resolve collaborators presence panel flicker (#523)#565
fix: resolve collaborators presence panel flicker (#523)#565Chris0Jeky merged 4 commits intomainfrom
Conversation
Add two tests: one verifying the current user is seeded immediately, another verifying graceful fallback to an empty list when no session is active.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Self-review: LGTM Root cause confirmed: Fix is minimal and surgical:
Potential concerns checked:
|
There was a problem hiding this comment.
Code Review
This pull request addresses a UI flicker issue (#523) where the collaborator panel would briefly appear empty before the SignalR connection was established. It introduces a currentUserPresenceSeed function to immediately populate the presence list with the current user's session data upon mounting or switching boards. Feedback includes suggestions to improve type safety in tests by avoiding 'as unknown' casts and a recommendation to deduplicate the presence seeding logic in the main view component.
| const mockSessionStore = reactive({ | ||
| userId: 'user-abc', | ||
| username: 'alice', | ||
| }) |
There was a problem hiding this comment.
To avoid the type casting with as unknown as string in your test case for an unauthenticated user, you could define the type of mockSessionStore more explicitly to allow null values for userId and username, which reflects the actual store's state possibilities.
| const mockSessionStore = reactive({ | |
| userId: 'user-abc', | |
| username: 'alice', | |
| }) | |
| const mockSessionStore = reactive<{ userId: string | null; username: string | null }>({ | |
| userId: 'user-abc', | |
| username: 'alice', | |
| }) |
| mockSessionStore.userId = null as unknown as string | ||
| mockSessionStore.username = null as unknown as string |
There was a problem hiding this comment.
If you apply the suggestion to add explicit types to mockSessionStore, you can remove the as unknown as string casts here, making the test cleaner.
| mockSessionStore.userId = null as unknown as string | |
| mockSessionStore.username = null as unknown as string | |
| mockSessionStore.userId = null | |
| mockSessionStore.username = null |
| const seed = currentUserPresenceSeed() | ||
| presenceMembers.value = seed | ||
| boardStore.setBoardPresenceMembers(seed) |
There was a problem hiding this comment.
Adversarial Review Pass 2Checks run: typecheck (vue-tsc, zero errors), vitest unit tests (1109/1109 passed) Findings:
Minor note (non-blocking): The test uses Fixes applied: None needed — no functional bugs found. Verdict: LGTM. The fix is correct, safe, and well-tested. Ready to merge. |
|
Addressed all three Gemini review comments:
|
Summary
onMountedresetpresenceMembersto[], then waited for the async SignalRBoardJoinedpush to arrive before showing the current user — creating a flicker window of several seconds.presenceMemberswith the current authenticated user immediately on mount (and on board-switch) usinguseSessionStore, beforefetchBoardorrealtime.startare called. The SignalR snapshot arriving later simply replaces the seed with the authoritative server list.Closes #523
Test plan
npm run typecheck)npx vitest --run)BoardView.spec.ts:seeds presence with the current user immediately on mount so the panel never flickers to emptyseeds presence with empty array when no user session is active