Skip to content

Commit

Permalink
handle log paused state when switching between logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jdrews committed Feb 14, 2023
1 parent cbe86f5 commit 31bcec2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions web/src/LogStationLogViewer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ const LogStationLogViewer = (props) => {
// reference for the LogViewer component
const logViewerRef = React.useRef();

// when the log file we're viewing changes, reset a few things
React.useEffect(() => {
setIsPaused(false)
}, [props.logFileName]);

React.useEffect(() => {
if (!isPaused) {
if (logViewerRef && logViewerRef.current) {
Expand Down
2 changes: 1 addition & 1 deletion web/src/MainLayout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const MainLayout = (props) => {
</Tabs>
</Box>
<Box sx={{width: '100%', height: '92vh'}} className="LogViewerBox">
<LogStationLogViewer data={props.logFiles.get(selectedLogFile) ?? []}/>
<LogStationLogViewer data={props.logFiles.get(selectedLogFile) ?? []} logFileName={selectedLogFile}/>
</Box>
</Container>
);
Expand Down

0 comments on commit 31bcec2

Please sign in to comment.