Code RoomRoom presence count stops updating
MediumPrep Room Coding #2022

Room presence count stops updating

Code reviewCode quality & reviewMid–Senior~18 min

Review this React TypeScript subscription component.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 18 min
Mark a line and say what kind of problem it is.0 findings
1function RoomPresence({ roomId, onCount }: { roomId: string; onCount: (n: number) => void }) {
2 useEffect(() => {
3 const sub = subscribe(roomId, (members) => {
4 onCount(members.length);
5 });
6 return () => sub.unsubscribe();
7 }, [roomId]);
8 
9 return null;
10}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.