[Bug]: Infinite websocket reconnect loop when user has no teams (fresh setup)
Before you file a bug report
- I have checked the issue tracker and have not found an issue that matches the one I'm filing.
- This issue is not a troubleshooting question. Troubleshooting questions go here: https://forum.mattermost.com/c/trouble-shoot/16.
- This issue is not a feature request. You can request features and make product suggestions here: https://mattermost.uservoice.com/forums/306457-general/.
- This issue reproduces on one of the currently supported server versions.
- I have read the contribution guidelines and the Mattermost Handbook Contribution Guidelines.
Mattermost Server Version
v11.6.0
Operating System
centos 9 stream on server + Windows 11 on client
Steps to reproduce
Fresh install Mattermost (v11.6.0) Create/login user Ensure user is not part of any team Open web UI
Expected behavior
Stable onboarding or team selection screen No WebSocket reconnect loop UI should remain functional when user has no teams
Observed behavior
Client redirects due to teams.length === 0 Main component unmounts WebSocket is closed (websocket closed manually) Client reconnects Loop repeats indefinitely
Log Output
Additional Information
Frontend routing triggers before app reaches stable state.
In logged_in.tsx:
if (teams.length === 0) { historyPush('/select_team'); return; }
This causes:
React unmount WebSocketClient.close() call reconnect cycle
Relevant file:
webapp/channels/src/components/logged_in/logged_in.tsx
WebSocket cleanup:
webapp/channels/src/utils/websocket.ts
Workaround
Create a team and add user:
mmctl team create main --display-name "Main" mmctl team users add main
Source: mattermost/mattermost