Skip to content

fix(desktop): resolve unarchive revert and stale member list bugs#558

Merged
wesbillman merged 1 commit into
mainfrom
desktop-fixes-batch
May 12, 2026
Merged

fix(desktop): resolve unarchive revert and stale member list bugs#558
wesbillman merged 1 commit into
mainfrom
desktop-fixes-batch

Conversation

@wesbillman
Copy link
Copy Markdown
Collaborator

Summary

  • Unarchive race condition: Removed the onSettled callback from useUnarchiveChannelMutation that was eagerly invalidating channel state, causing a stale refetch to overwrite the optimistic archivedAt: null update. The onSuccess handler already sets the correct state.
  • Stale member list after join/leave: When a system message (kind 40099) with member_joined, member_left, or member_removed payload arrives via the channel subscription, we now invalidate the members query cache and the channels list so the UI reflects membership changes immediately.

Files changed

  • desktop/src/features/channels/hooks.ts — removed 3-line onSettled callback
  • desktop/src/features/messages/hooks.ts — added KIND_SYSTEM_MESSAGE import + 21 lines of membership cache invalidation logic

Test plan

  • Unarchive a channel → verify it stays unarchived (no flicker/revert)
  • Have another user join/leave a channel → verify the member list updates without manual refresh
  • pnpm typecheck passes clean

🤖 Generated with Claude Code

Remove the onSettled refetch from useUnarchiveChannelMutation to prevent
a race condition where the relay returns stale archived metadata before
processing the unarchive event, overwriting the optimistic update.

Invalidate the channel members query cache when membership system
messages (member_joined, member_left, member_removed) arrive via the
channel subscription, so the member list updates in real-time without
requiring a reload.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wesbillman wesbillman merged commit 8004baf into main May 12, 2026
15 checks passed
@wesbillman wesbillman deleted the desktop-fixes-batch branch May 12, 2026 23:55
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.

1 participant