mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-20 07:13:05 +00:00
fix: clear structured log viewer rows on stack switch (#1448)
The structured log viewer accumulated log rows across stack switches because the useEffect cleanup closed the old WebSocket but never cleared the committed rows state. Reset rows, row IDs, and auto-follow at the top of the effect before connecting to the new stack. The level filter is intentionally preserved across switches. Closes #1444
This commit is contained in:
@@ -68,6 +68,13 @@ export default function StructuredLogViewer({ stackName }: StructuredLogViewerPr
|
||||
useEffect(() => { followingRef.current = following; }, [following]);
|
||||
|
||||
useEffect(() => {
|
||||
// Reset state accumulated from the previous stack before connecting.
|
||||
// eslint-disable-next-line react-hooks/set-state-in-effect
|
||||
setRows([]);
|
||||
rowIdRef.current = 0;
|
||||
setFollowing(true);
|
||||
followingRef.current = true;
|
||||
|
||||
const cleanStackName = stackName.replace(/\.(yml|yaml)$/, '');
|
||||
const wsProtocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const activeNodeId = localStorage.getItem('sencho-active-node') || '';
|
||||
|
||||
Reference in New Issue
Block a user