Skip to content

Commit 3d2307b

Browse files
garland3claude
andauthored
Fix/log viewer pagination (#39)
* added prompts back in for testing * fix: reset log viewer pagination to show newest entries when auto-scroll enabled When new log entries arrived during auto-refresh, users viewing pages beyond page 0 would not see the newest entries. Now automatically resets to page 0 when new logs are detected and auto-scroll is enabled, ensuring newest logs are always visible. Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
1 parent 32cd05e commit 3d2307b

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

config/overrides/mcp.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@
4141
"author": "Chat UI Team",
4242
"short_description": "File transfer test tool",
4343
"help_email": "[email protected]"
44+
},
45+
"prompts": {
46+
"command": ["python", "mcp/prompts/main.py"],
47+
"cwd": "backend",
48+
"groups": ["users"],
49+
"is_exclusive": false,
50+
"description": "Specialized system prompts for AI behavior modification",
51+
"author": "Chat UI Team",
52+
"short_description": "AI behavior prompts",
53+
"help_email": "[email protected]"
4454
}
4555

4656
}

frontend/src/components/LogViewer.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ export default function LogViewer() {
4141
return r.json();
4242
})
4343
.then(data => {
44-
setEntries(data.entries || []);
44+
const newEntries = data.entries || [];
45+
// Reset to page 0 if auto-scroll is enabled and new entries were added
46+
if (autoScrollEnabled && newEntries.length > entries.length) {
47+
setPage(0);
48+
}
49+
setEntries(newEntries);
4550
setError(null);
4651
// After updating entries, scroll to bottom if auto-scroll is enabled and user hasn't scrolled up
4752
requestAnimationFrame(() => {
@@ -52,7 +57,7 @@ export default function LogViewer() {
5257
})
5358
.catch(err => setError(err))
5459
.finally(() => setLoading(false));
55-
}, [levelFilter, moduleFilter, autoScrollEnabled]); // Dependencies for fetchLogs
60+
}, [levelFilter, moduleFilter, autoScrollEnabled, entries.length]); // Dependencies for fetchLogs
5661

5762
// Function to clear all logs
5863
const clearLogs = useCallback(() => {

0 commit comments

Comments
 (0)