Skip to content

refactor(frontend): add useAutoRefresh for PageRefreshBar pages - #435

Open
Rem7474 wants to merge 1 commit into
refactor/type-alert-capabilitiesfrom
refactor/use-auto-refresh
Open

Rem7474 wants to merge 1 commit into
refactor/type-alert-capabilitiesfrom
refactor/use-auto-refresh

Conversation

@Rem7474

@Rem7474 Rem7474 commented Sep 30, 2026

Copy link
Copy Markdown
Owner

Summary

~15 composables hand-built the same auto-refresh scaffolding (toggle ref, lastUpdatedAt, setInterval guarded by the toggle, clearInterval on unmount, sometimes start/stop helpers).

useAutoRefresh(tick, { intervalSec, enabled?, skip? }) → { autoRefresh, lastUpdatedAt }
  • enabled: externally owned toggle (monitoring host detail shares one bar between the uptime and SSL sections)
  • skip: skip a tick during a mutation that reloads on its own
  • initial load stays with the caller

Migrated (7): useSslCertificates, useUptimeProbes, useSSLCertificateDetail, useUptimeProbeDetail, useProxmox, useNPM (skip while a monitoring toggle is in flight), useUsers (skip while a role change/delete is in flight). Intervals and behaviour unchanged.

Not yet migrated (follow-ups, a few per PR): useProxmoxGuest, useProxmoxNode, useGlobalScheduledTasks, useBot, useTraffic (two cadences), HostExposureTab, HostTimelineTab, useDashboard, AlertsView, useAuditLogs, useRunbooks.

frontend/CLAUDE.md points new pages at the composable.

Stacked on #434.

Test plan

  • useAutoRefresh.spec.ts (interval ticks, toggle pause, external toggle, skip, unmount)
  • Existing specs of the migrated composables green (incl. the uptime detail "auto-refresh without override props" regression test); full suite, typecheck, lint
  • Manual: pause/resume the refresh bar on Monitoring, NPM, Proxmox and Users pages

🤖 Generated with Claude Code

@Rem7474
Rem7474 force-pushed the refactor/type-alert-capabilities branch from 60b7275 to 720529a Compare September 30, 2026 19:31
@Rem7474
Rem7474 force-pushed the refactor/use-auto-refresh branch from 276d4ef to b88dd11 Compare September 30, 2026 19:31
About fifteen composables rebuilt the same auto-refresh scaffolding by
hand: an autoRefresh toggle, a lastUpdatedAt ref, a setInterval guarded by
the toggle, and a clearInterval on unmount (some through start/stop timer
helpers). useAutoRefresh(tick, { intervalSec, enabled?, skip? }) owns it;
`enabled` covers a parent page sharing one refresh bar, `skip` a tick that
must not run during a mutation.

Migrated: useSslCertificates, useUptimeProbes, useSSLCertificateDetail,
useUptimeProbeDetail, useProxmox, useNPM (skips while a monitoring toggle
is in flight) and useUsers (skips while a role change/delete is in
flight). The remaining pages move in follow-ups.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rem7474
Rem7474 force-pushed the refactor/use-auto-refresh branch from b88dd11 to e8e1b40 Compare September 30, 2026 19:37
@Rem7474
Rem7474 force-pushed the refactor/type-alert-capabilities branch from 720529a to 3af0beb Compare September 30, 2026 19:37
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant