Skip to content

Commit

Permalink
[ui] Fix endless log loading
Browse files Browse the repository at this point in the history
  • Loading branch information
hellendag committed Dec 12, 2024
1 parent 303625c commit 60ac241
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,17 @@ const reducer = (state: State, action: Action) => {
...node,
clientsideKey: `csk${node.timestamp}-${ii}`,
}));
const nodes = [...state.nodes, ...queuedNodes];

const copy = state.nodes.slice();
copy.push(...queuedNodes);

const counts = {...state.counts};
queuedNodes.forEach((node) => {
const level = logNodeLevel(node);
counts[level]++;
});
return {nodes, counts, loading: action.hasMore, cursor: action.cursor};

return {nodes: copy, counts, loading: action.hasMore, cursor: action.cursor};
}
case 'set-cursor':
return {...state, cursor: action.cursor};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Box, Colors, NonIdealState, Row} from '@dagster-io/ui-components';
import {Box, Colors, NonIdealState, Row, SpinnerWithText} from '@dagster-io/ui-components';
import {useVirtualizer} from '@tanstack/react-virtual';
import {useEffect, useRef} from 'react';
import styled from 'styled-components';
Expand Down Expand Up @@ -81,12 +81,10 @@ export const LogsScrollingTable = (props: Props) => {
}, [totalHeight, virtualizer]);

const content = () => {
if (logs.loading) {
if (logs.allNodes.length === 0 && logs.loading) {
return (
<Box margin={{top: 32}}>
<ListEmptyState>
<NonIdealState icon="spinner" title="Fetching logs..." />
</ListEmptyState>
<Box margin={{top: 32}} flex={{direction: 'column', alignItems: 'center'}}>
<SpinnerWithText label="Loading run logs…" />
</Box>
);
}
Expand Down

0 comments on commit 60ac241

Please sign in to comment.