Skip to content

Commit b2c4335

Browse files
committed
fix: minor enhancement
1 parent 8790b6f commit b2c4335

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

api/src/chat/services/block.service.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,14 @@ export class BlockService extends BaseService<
8181
subscribe(@SocketReq() req: SocketRequest, @SocketRes() res: SocketResponse) {
8282
try {
8383
if (req.session.web?.profile?.id) {
84-
this.gateway.io.socketsJoin(`blocks:${req.session.web.profile.id}`);
84+
const room = `blocks:${req.session.web.profile.id}`;
85+
this.gateway.io.socketsJoin(room);
86+
this.logger.log('Subscribed to socket room', room);
8587
return res.status(200).json({
8688
success: true,
8789
});
8890
} else {
91+
this.logger.error('Unable to subscribe to highlight blocks room');
8992
throw new Error('Unable to join highlight blocks room');
9093
}
9194
} catch (e) {

api/src/websocket/websocket.gateway.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,14 +413,15 @@ export class WebsocketGateway
413413
async handleHighlightBlock(
414414
payload: IHookOperationMap['highlight']['operations']['block'],
415415
) {
416+
this.logger.log('highlighting block', payload);
416417
this.io.to(`blocks:${payload.userId}`).emit('highlight:block', payload);
417418
}
418419

419420
@OnEvent('hook:highlight:error')
420421
async highlightBlockErrored(
421422
payload: IHookOperationMap['highlight']['operations']['error'],
422423
) {
423-
this.logger.warn('hook:highlight:error ', payload);
424+
this.logger.warn('hook:highlight:error', payload);
424425
this.io.to(`blocks:${payload.userId}`).emit('highlight:error', payload);
425426
}
426427
}

frontend/src/websocket/socket-hooks.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,7 @@ export const SocketProvider = (props: PropsWithChildren) => {
4141
const [connected, setConnected] = useState(false);
4242
const { toast } = useToast();
4343
const { user } = useAuth();
44-
const socket = useMemo(
45-
() => new SocketIoClient(apiUrl, { auth: user }),
46-
[apiUrl],
47-
);
44+
const socket = useMemo(() => new SocketIoClient(apiUrl), [apiUrl]);
4845

4946
useEffect(() => {
5047
if (user && apiUrl)

0 commit comments

Comments
 (0)