fix(web): replace actor_id self-event filtering with idempotent cache updates
actor_id identifies the user, not the browser tab. Filtering WS events by actor_id broke multi-tab sync — other tabs of the same user would silently miss updates. Instead, make all WS cache handlers idempotent (dedup checks on add, no-op on duplicate merge/filter) so mutations and WS events coexist safely without filtering. - WSClient: pass actor_id to event handlers for future per-handler use - use-realtime-sync: remove isSelf() gating from onAny and specific handlers - useCreateIssue: add .some() dedup guard + onSettled invalidation - use-issue-reactions: remove payload-level self-filter (dedup already present) - use-issue-timeline: remove payload-level self-filter on comment:created, reaction:added, reaction:removed (dedup already present) - Clean up useCallback deps that no longer reference userId Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
88c2f4ddc4
commit
d58f6cdb33
7 changed files with 20 additions and 32 deletions
|
|
@ -1,7 +1,7 @@
|
|||
import type { WSMessage, WSEventType } from "@/shared/types";
|
||||
import { type Logger, noopLogger } from "@/shared/logger";
|
||||
|
||||
type EventHandler = (payload: unknown) => void;
|
||||
type EventHandler = (payload: unknown, actorId?: string) => void;
|
||||
|
||||
export class WSClient {
|
||||
private ws: WebSocket | null = null;
|
||||
|
|
@ -53,7 +53,7 @@ export class WSClient {
|
|||
const eventHandlers = this.handlers.get(msg.type);
|
||||
if (eventHandlers) {
|
||||
for (const handler of eventHandlers) {
|
||||
handler(msg.payload);
|
||||
handler(msg.payload, msg.actor_id);
|
||||
}
|
||||
}
|
||||
for (const handler of this.anyHandlers) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue