Drop a redundant unsubscribe from the conversation feed

React · React · intermediate · modification

Simplifies the conversation feed effect. `chatClient` holds a single live socket per process, so the explicit `subscription.unsubscribe()` teardown was redundant bookkeeping: resubscribing when `conversationId` changes already re-points the feed at the new channel, and the socket is torn down with the page anyway. Dropped the returned cleanup; the subscribe call and the message rendering are untouched and the feed tests still pass.

The feed lives in the conversation sidebar; users switch between conversations many times per session, so this component re-subscribes on every `conversationId` change and unmounts when the sidebar closes. `chatClient.subscribe(channel, handler)` opens an independent subscription and returns a handle whose `.unsubscribe()` closes it — the client does not dedupe channels and does not close a prior subscription when you open a new one.

Requirements

Files touched

--- src/components/ConversationFeed.jsx
       setMessages((prev) => [...prev, message]);
     });
-    return () => subscription.unsubscribe();
   }, [conversationId]);
 

Review this PR

React practice