Skip to content

Fix logs disappearing when a container is stopped | ROVER-629 - #61

Open
jaydizz0 wants to merge 1 commit into
mainfrom
fix-logs-clearing-on-stop
Open

Fix logs disappearing when a container is stopped | ROVER-629#61
jaydizz0 wants to merge 1 commit into
mainfrom
fix-logs-clearing-on-stop

Conversation

@jaydizz0

Copy link
Copy Markdown

Fixes ROVER-629 - logs were disappearing as soon as you hit stop, even though the container hadn't actually finished shutting down yet.

Turned out there were two things causing this:

  1. The component had one effect that cleared the logs whenever option.status changed, not just when a new container actually started. So clicking stop triggered the same clear that was only supposed to happen for a new container:
useEffect(() => {
  setStatusState(option.status);
  setLogs([]);
  setEventMsg(externalEventMsg);
}, [option.id, externalEventMsg, option.status]);
  1. Even if that part was fixed, the whole logs box was hidden any time status was 'stopped', no matter what was actually in it:
{statusState !== 'stopped' && (
  <div>...Live Logs...</div>
)}

Fixed by splitting that effect into three, so logs only get cleared when option.id actually changes (a real new container), and changed the render check so the box stays up if there's still something in logs.

I don't have a real container-launcher running locally to test against, so I built a small throwaway test page + a fake websocket server to feed fake log lines into the real ContainerCard component and reproduce the bug directly. Confirmed logs used to vanish instantly on stop, and now they stick around after. Deleted both test files before this commit, so it's just the actual fix.

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