Skip to content

Conversation

@skylenet
Copy link
Member

@skylenet skylenet commented Jan 9, 2026

No description provided.

Replace ResponsiveContainer with manual dimension management to fix
console warnings about -1 width/height during initial render.

Changes:
- Track container width with ResizeObserver instead of ResponsiveContainer
- Pass explicit width and height props directly to BarChart/LineChart
- Only render charts when container has valid dimensions (width > 0)
- Use fixed height constants matching Tailwind classes (h-20=80px, h-48=192px)
Avoid calling close() on WebSocket in CONNECTING state which causes
browser warning "WebSocket is closed before connection is established".

Changes:
- Add isDisconnectingRef flag to track intentional disconnection
- In disconnect(): only close if WebSocket is already OPEN
- In onopen: check flag and close immediately if disconnect was called
  while connecting
- Prevent reconnect attempts when intentionally disconnecting
@skylenet skylenet changed the title fix(ui) resolve Recharts dimension warnings and prevent Websocket close warning fix(ui): resolve Recharts dimension warnings and prevent Websocket close warning Jan 9, 2026
@skylenet skylenet merged commit 1e63a2e into master Jan 9, 2026
3 checks passed
@skylenet skylenet deleted the fix-ui-warning branch January 9, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant