Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

perf: replace CityHud scan line setInterval with CSS animation

Adam Eivy42ccecf7f4f1
diff --git a/.changelog/v0.17.x.md b/.changelog/v0.17.x.md
index bb0836494c..dfae68b8b6 100644
--- a/.changelog/v0.17.x.md
+++ b/.changelog/v0.17.x.md
@@ -12,3 +12,9 @@ JIRA integration improvements and token lifecycle management.
- **Tracks `tokenUpdatedAt`** on each instance when a PAT is saved, separate from `updatedAt` which changes on any edit
- **Client shows expiry warnings** based on 30-day PAT lifetime: yellow warning at 5 days remaining, red alert when expired
- **Handles legacy instances** without `tokenUpdatedAt` gracefully — prompts user to re-save to start tracking
+
+## Improvements
+
+### CityHud scan line: CSS animation instead of setInterval
+- Replaced 50ms `setInterval` (20 React re-renders/sec) with a pure CSS `@keyframes` animation
+- Eliminates unnecessary React state updates and re-renders for a visual-only effect
diff --git a/client/src/components/city/CityHud.jsx b/client/src/components/city/CityHud.jsx
index 386cee6b99..d49e4c0e6b 100644
--- a/client/src/components/city/CityHud.jsx
+++ b/client/src/components/city/CityHud.jsx
@@ -99,8 +99,6 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con
const location = useLocation();
const [time, setTime] = useState(new Date());
const [uptimeSeconds, setUptimeSeconds] = useState(0);
- const [scanLine, setScanLine] = useState(0);
-
useEffect(() => {
const interval = setInterval(() => {
setTime(new Date());
@@ -109,14 +107,6 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con
return () => clearInterval(interval);
}, []);
- // Animated scan line in the vitals panel
- useEffect(() => {
- const interval = setInterval(() => {
- setScanLine(prev => (prev + 1) % 100);
- }, 50);
- return () => clearInterval(interval);
- }, []);
-
const activeApps = apps.filter(a => !a.archived && a.overallStatus === 'online').length;
const stoppedApps = apps.filter(a => !a.archived && a.overallStatus === 'stopped').length;
const totalApps = apps.filter(a => !a.archived).length;
@@ -159,10 +149,9 @@ export default function CityHud({ cosStatus, cosAgents, agentMap, eventLogs, con
<HudCorner position="bl" />
<HudCorner position="br" />
- {/* Animated scan line */}
+ {/* Animated scan line (CSS-only, no React re-renders) */}
<div
- className="absolute left-0 right-0 h-px bg-cyan-400/15 pointer-events-none"
- style={{ top: `${scanLine}%` }}
+ className="absolute left-0 right-0 h-px bg-cyan-400/15 pointer-events-none animate-[scanline_5s_linear_infinite]"
/>
<div className="font-pixel text-[10px] text-cyan-500/70 tracking-wider mb-1">
diff --git a/client/tailwind.config.js b/client/tailwind.config.js
index 4b33b30fee..e6d23baec9 100644
--- a/client/tailwind.config.js
+++ b/client/tailwind.config.js
@@ -14,7 +14,13 @@ export default {
'port-success': '#22c55e',
'port-warning': '#f59e0b',
'port-error': '#ef4444'
- }
+ },
+ keyframes: {
+ scanline: {
+ '0%': { top: '0%' },
+ '100%': { top: '100%' },
+ },
+ },
},
},
plugins: [],