Commit Graph

9 Commits

Author SHA1 Message Date
Haileyesus
a35140bc5e refactor: update WebSocket connection effect to depend on token changes for reconnection 2026-02-02 12:20:51 +03:00
Haileyesus
438b9698cc refactor: optimize WebSocket connection handling with useCallback and useMemo 2026-01-31 15:56:34 +03:00
Haileyesus
20d31da4f4 refactor: replace messages with latestMessage in WebSocket context and related components
Why?
Because, messages was only being used to access the latest message in the components it's used in.
2026-01-31 15:43:24 +03:00
Haileyesus
b2fdb90203 refactor: move IS_PLATFORM to config file for both frontend and backend
The reason we couldn't place it in shared/modelConstants.js is that the
frontend uses Vite which requires import.meta.env for environment variables,
while the backend uses process.env. Therefore, we created separate config files
for the frontend (src/constants/config.ts) and backend (server/constants/config.js).
2026-01-31 15:01:17 +03:00
Haileyesus
cfd766819a refactor: Centralize platform mode detection using IS_PLATFORM constant; use token from Auth context in WebSocket connection 2026-01-31 14:34:01 +03:00
Haileyesus
471892b2bd refactor: Extract WebSocket URL construction into a separate function 2026-01-31 12:03:40 +03:00
Haileyesus
eca96c6973 fix: Prevent WebSocket reconnection attempts after unmount
Right now, when the WebSocketContext component unmounts,
there is still a pending reconnection attempt that tries
to reconnect the WebSocket after 3 seconds.
2026-01-31 11:58:46 +03:00
Haileyesus
5a4813f9bd fix: add type definition for WebSocket URL and remove redundant protocol declaration 2026-01-31 11:54:24 +03:00
Haileyesus
f6970d6ad9 fix: replace WebSocketContext default value with null and add type definitions 2026-01-31 11:45:46 +03:00