ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
chore(frontend): delete the dead useContainerStatus hook and its legacy-poller entry
Juan Denis4fcd0db4d560
diff --git a/docs/MIGRATION_INVENTORY.md b/docs/MIGRATION_INVENTORY.mdindex fa78ccdf..3ec2f353 100644--- a/docs/MIGRATION_INVENTORY.md+++ b/docs/MIGRATION_INVENTORY.md@@ -23,7 +23,7 @@ debt. Regenerate with `python scripts/generate-migration-inventory.py`.| per-page toast.error extractions in pages/ | E1: query-layer error presentation | 264 | 264 | migrate when touched || hand-rolled form-group blocks | F2: FormField/useForm | 343 | 343 | migrate when touched || unencoded ?k=${v} query interpolations in services/api | C4: buildQuery/encoding template | 97 | 97 | migrate when touched |-| raw setInterval pollers | E2: usePolling/refetchInterval | 11 | 11 | DELIBERATE RESIDUE: clock ticks, socket-fallback hooks, and sibling-repo extension timers - each listed per file |+| raw setInterval pollers | E2: usePolling/refetchInterval | 10 | 10 | DELIBERATE RESIDUE: clock ticks, socket-fallback hooks, and sibling-repo extension timers - each listed per file || direct navigator.clipboard call sites | F3: copyToClipboard | 0 | 0 | INVARIANT at 0 || hex colour literals outside token files | G: var(--token) | 151 | 151 | migrate when touched || SCSS class names defined in multiple files | single-owner partials | 114 | 114 | needs eyes on pages (no byte-identical proof available) |diff --git a/frontend/scripts/check-frontend-boundaries.mjs b/frontend/scripts/check-frontend-boundaries.mjsindex ed7a67ee..8508ea35 100644--- a/frontend/scripts/check-frontend-boundaries.mjs+++ b/frontend/scripts/check-frontend-boundaries.mjs@@ -92,7 +92,6 @@ const LEGACY_POLLERS = new Map(Object.entries({'components/dashboard/widgets/renderers.jsx': 1,'components/deploy-console/SuccessBanner.jsx': 1,'components/server/OnboardingWizard.jsx': 1,- 'hooks/useContainerStatus.js': 1,'hooks/useDeployJobStream.js': 1,'hooks/useMetrics.js': 1,'pages/Dashboard.jsx': 2,diff --git a/frontend/src/hooks/useContainerStatus.js b/frontend/src/hooks/useContainerStatus.jsdeleted file mode 100644index cb0ff83f..00000000--- a/frontend/src/hooks/useContainerStatus.js+++ /dev/null@@ -1,111 +0,0 @@-import { useState, useEffect, useCallback, useRef } from 'react';-import socketService from '../services/socket';-import api from '../services/api';--// Default REST poll fallback interval in ms (10 seconds).-const DEFAULT_POLL_INTERVAL = 10000;--/**- * Subscribe to the aggregated container status for a single application.- *- * Prefers the real-time 'container_status' socket channel; falls back to a- * periodic REST poll when the socket isn't connected. Returns the aggregated- * status dict ({status, total, healthy, reasons, containers, ...}) plus a- * manual `refetch` and a `connected` flag.- *- * @param {number|string} appId- * @param {object} [opts]- * @param {boolean} [opts.useWebSocket=true]- * @param {number} [opts.pollInterval=10000]- */-export function useContainerStatus(appId, opts = {}) {- const { useWebSocket = true, pollInterval = DEFAULT_POLL_INTERVAL } = opts;-- const [status, setStatus] = useState(null);- const [loading, setLoading] = useState(true);- const [connected, setConnected] = useState(false);- const pollRef = useRef(null);-- const refetch = useCallback(async () => {- if (appId === null || appId === undefined) return;- try {- const data = await api.getAppContainerStatus(appId);- setStatus(data);- } catch {- // Leave the last-known status in place on a transient error.- } finally {- setLoading(false);- }- }, [appId]);-- const startPolling = useCallback(() => {- if (pollRef.current || pollInterval <= 0) return;- pollRef.current = setInterval(refetch, pollInterval);- }, [refetch, pollInterval]);-- const stopPolling = useCallback(() => {- if (pollRef.current) {- clearInterval(pollRef.current);- pollRef.current = null;- }- }, []);-- useEffect(() => {- if (appId === null || appId === undefined) return undefined;-- // Initial fetch so the pill has a value immediately.- refetch();-- if (!useWebSocket) {- startPolling();- return () => stopPolling();- }-- socketService.connect();-- // The status channel isn't a first-class method on the socket service,- // so attach to the raw socket and emit the subscribe directly. Both are- // guarded for the not-yet-connected case.- const subscribe = () => {- setConnected(true);- stopPolling();- socketService.socket?.emit('subscribe_container_status');- };-- // Each tick the server pushes only the apps that changed; reconcile by id.- const onStatus = (payload) => {- const statuses = payload?.statuses || [];- const mine = statuses.find((s) => String(s.app_id) === String(appId));- if (mine) {- setStatus((prev) => ({ ...(prev || {}), ...mine, app_id: mine.app_id }));- setLoading(false);- }- };-- if (socketService.socket?.connected) subscribe();- const unsubConnect = socketService.on('connected', subscribe);- const unsubDisconnect = socketService.on('disconnected', () => {- setConnected(false);- startPolling();- });- socketService.socket?.on('container_status', onStatus);-- // Give the socket a moment to connect before falling back to polling.- const pollTimeout = setTimeout(() => {- if (!socketService.socket?.connected) startPolling();- }, 3000);-- return () => {- clearTimeout(pollTimeout);- unsubConnect();- unsubDisconnect();- socketService.socket?.off('container_status', onStatus);- socketService.socket?.emit('unsubscribe_container_status');- stopPolling();- };- }, [appId, useWebSocket, refetch, startPolling, stopPolling]);-- return { status, loading, connected, refetch };-}--export default useContainerStatus;