Spaces:
Running
Running
Commit Β·
93c72b5
1
Parent(s): b1370a3
fix: input tab order and remove auto-scroll on panel open
Browse files
frontend/src/components/CodePanel/CodePanel.tsx
CHANGED
|
@@ -221,10 +221,16 @@ export default function CodePanel() {
|
|
| 221 |
return visibleSection.content;
|
| 222 |
}, [visibleSection?.content, visibleSection?.language]);
|
| 223 |
|
|
|
|
|
|
|
| 224 |
useEffect(() => {
|
| 225 |
-
|
|
|
|
|
|
|
|
|
|
| 226 |
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
| 227 |
}
|
|
|
|
| 228 |
}, [displayContent, panelView]);
|
| 229 |
|
| 230 |
// ββ Syntax-highlighted code block (DRY) ββββββββββββββββββββββββ
|
|
@@ -491,7 +497,7 @@ export default function CodePanel() {
|
|
| 491 |
{/* Input / Output toggle */}
|
| 492 |
{panelData?.input && panelView === 'output' && (
|
| 493 |
<Box sx={{ display: 'flex', gap: 0.5, mb: 1.5 }}>
|
| 494 |
-
{['
|
| 495 |
<Typography
|
| 496 |
key={tab}
|
| 497 |
onClick={() => setShowInput(tab === 'input')}
|
|
|
|
| 221 |
return visibleSection.content;
|
| 222 |
}, [visibleSection?.content, visibleSection?.language]);
|
| 223 |
|
| 224 |
+
// Auto-scroll only for live log streaming, not when opening panel
|
| 225 |
+
const hasAutoScrolled = useRef(false);
|
| 226 |
useEffect(() => {
|
| 227 |
+
hasAutoScrolled.current = false;
|
| 228 |
+
}, [panelData]);
|
| 229 |
+
useEffect(() => {
|
| 230 |
+
if (scrollRef.current && panelView === 'output' && hasAutoScrolled.current) {
|
| 231 |
scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
|
| 232 |
}
|
| 233 |
+
hasAutoScrolled.current = true;
|
| 234 |
}, [displayContent, panelView]);
|
| 235 |
|
| 236 |
// ββ Syntax-highlighted code block (DRY) ββββββββββββββββββββββββ
|
|
|
|
| 497 |
{/* Input / Output toggle */}
|
| 498 |
{panelData?.input && panelView === 'output' && (
|
| 499 |
<Box sx={{ display: 'flex', gap: 0.5, mb: 1.5 }}>
|
| 500 |
+
{['input', 'output'].map((tab) => (
|
| 501 |
<Typography
|
| 502 |
key={tab}
|
| 503 |
onClick={() => setShowInput(tab === 'input')}
|