Skip to content

Commit ff6e92c

Browse files
author
Dylan Huang
committed
okay logs loading works
1 parent ed40ad1 commit ff6e92c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

vite-app/src/components/LogsSection.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ export const LogsSection = observer(({ rolloutId }: LogsSectionProps) => {
1616
const [isExpanded, setIsExpanded] = useState(false);
1717
const [selectedLevel, setSelectedLevel] = useState<string>("");
1818

19-
const fetchLogs = async () => {
19+
const fetchLogs = async (isInitialLoad = false) => {
2020
if (!rolloutId) return;
2121

22-
setLoading(true);
22+
// Only show loading on initial load, not during polling
23+
if (isInitialLoad) {
24+
setLoading(true);
25+
}
2326
setError(null);
2427

2528
try {
@@ -98,8 +101,8 @@ export const LogsSection = observer(({ rolloutId }: LogsSectionProps) => {
98101

99102
useEffect(() => {
100103
if (isExpanded && rolloutId) {
101-
fetchLogs(); // Initial load
102-
const interval = setInterval(fetchLogs, 5000); // Poll every 5 seconds
104+
fetchLogs(true); // Initial load
105+
const interval = setInterval(() => fetchLogs(false), 5000); // Poll every 5 seconds without loading state
103106
return () => clearInterval(interval);
104107
}
105108
}, [isExpanded, rolloutId, selectedLevel]);
@@ -152,7 +155,7 @@ export const LogsSection = observer(({ rolloutId }: LogsSectionProps) => {
152155
<option value="ERROR">ERROR</option>
153156
</Select>
154157
<Button
155-
onClick={fetchLogs}
158+
onClick={() => fetchLogs(true)}
156159
variant="primary"
157160
size="sm"
158161
disabled={loading}

0 commit comments

Comments
 (0)