Trim comments across Rust and webapp source to direct one-liners (ticket 030)
Pass over src/*.rs, webapp/src/**, and the in-app "?" docs prose: condensed multi-paragraph doc comments to single lines that state the non-obvious why, deleted comments that only restated adjacent code, and tightened the Docs.tsx help-panel wording. No logic, structure, or code formatting changed — verified via cargo test (143 passed) and tsc -b && vite build. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
3cef6dc8ae
commit
00c21c8032
+8
-28
@@ -22,11 +22,7 @@ import { DocsNavProvider } from './lib/docsNav'
|
||||
|
||||
const POLL_MS = 2000
|
||||
|
||||
/// Reads the standalone-page routing params written by `PopOutButton`
|
||||
/// (ticket 036) — a `section` id selects one of the four primary sections to
|
||||
/// render full-page with no nav/sibling chrome, and `startMs`/`endMs` carry
|
||||
/// over the range that was active at pop-out time for sections that have no
|
||||
/// `LogTimeline` of their own to pick one.
|
||||
/// Reads the routing params `PopOutButton` writes: `section` picks which primary section to render full-page, and `startMs`/`endMs` carry over the range for sections with no `LogTimeline` of their own to pick one.
|
||||
function parsePopOutQuery(): { section: PopOutSectionId | null; range: TimeRange | null } {
|
||||
const query = new URLSearchParams(window.location.search)
|
||||
const section = query.get('section') as PopOutSectionId | null
|
||||
@@ -46,9 +42,7 @@ function StandalonePage({ children }: { children: ReactNode }) {
|
||||
)
|
||||
}
|
||||
|
||||
/// Params has no lifted-state sibling to share `params`/`loadParams` with
|
||||
/// when popped out on its own, so it owns a minimal fetch of its own here
|
||||
/// rather than App's full `loadParams` machinery.
|
||||
/// Popped out on its own, Params has no lifted-state sibling to share `params`/`loadParams` with, so it owns a minimal fetch here instead.
|
||||
function StandaloneParams() {
|
||||
const [params, setParams] = useState<ParamDeclaration[]>([])
|
||||
|
||||
@@ -71,15 +65,12 @@ function StandaloneParams() {
|
||||
)
|
||||
}
|
||||
|
||||
/// Metrics/Dashboards already own their own data fetching — they only need
|
||||
/// the range that was active at pop-out time, carried over via query params.
|
||||
/// Metrics/Dashboards own their own data fetching — they only need the range carried over via query params.
|
||||
function StandaloneRanged({ section, range }: { section: 'metrics' | 'dashboards'; range: TimeRange | null }) {
|
||||
return <StandalonePage>{section === 'metrics' ? <Metrics range={range} /> : <Dashboards range={range} />}</StandalonePage>
|
||||
}
|
||||
|
||||
/// The log viewer has its own `LogTimeline` to pick a range, so it doesn't
|
||||
/// need one carried over — it just needs its own copy of App's log/timeline
|
||||
/// polling state, since none of that is shared with any sibling here.
|
||||
/// The log viewer has its own `LogTimeline`, so it needs its own copy of App's log/timeline polling state instead of a carried-over range.
|
||||
function StandaloneLog() {
|
||||
const [logs, setLogs] = useState<LogEntry[]>([])
|
||||
const [params, setParams] = useState<ParamDeclaration[]>([])
|
||||
@@ -194,11 +185,7 @@ function FullApp() {
|
||||
const [filterError, setFilterError] = useState<string | null>(null)
|
||||
const [logViewerCollapsed, setLogViewerCollapsed] = useSectionCollapsed('log-viewer')
|
||||
|
||||
// Read from inside the poll loop below without making it a dependency —
|
||||
// a rolling preset's own re-resolution (ticket 024) updates `range`, and
|
||||
// depending on `range` directly would restart the effect (and its
|
||||
// interval) every tick, turning "poll every POLL_MS" into "poll as fast as
|
||||
// React can re-render."
|
||||
// Read via ref inside the poll loop instead of depending on `range` directly, which would restart the interval every rolling-preset tick.
|
||||
const rangeRef = useRef(range)
|
||||
useEffect(() => {
|
||||
rangeRef.current = range
|
||||
@@ -221,9 +208,7 @@ function FullApp() {
|
||||
setRange(computePresetRange(id))
|
||||
}
|
||||
|
||||
// A drag on LogTimeline always yields a fixed (non-rolling) range,
|
||||
// overriding whatever preset was active — same as picking a preset
|
||||
// overrides a previous drag.
|
||||
// A drag always yields a fixed (non-rolling) range, overriding any active preset.
|
||||
function handleManualRangeSelect(next: TimeRange | null) {
|
||||
if (next === null) {
|
||||
selectPreset('all')
|
||||
@@ -237,8 +222,7 @@ function FullApp() {
|
||||
let cancelled = false
|
||||
|
||||
async function poll() {
|
||||
// Rolling presets "move with time": re-resolve on this same polling
|
||||
// cadence rather than freezing the window at selection time.
|
||||
// Rolling presets re-resolve on this same polling cadence instead of freezing the window at selection time.
|
||||
const effectiveRange =
|
||||
activePreset && activePreset !== 'all' ? computePresetRange(activePreset) : rangeRef.current
|
||||
if (activePreset && activePreset !== 'all') {
|
||||
@@ -273,11 +257,7 @@ function FullApp() {
|
||||
cancelled = true
|
||||
clearInterval(id)
|
||||
}
|
||||
// Intentionally excludes `range`: a manual drag (which does change
|
||||
// `activePreset` to null) still gets an immediate poll; only a second
|
||||
// drag made while already in fixed-range mode waits for the next
|
||||
// interval tick, which is an acceptable trade-off for not restarting
|
||||
// this effect (and its interval) every rolling-preset tick.
|
||||
// Intentionally excludes `range` to avoid restarting this interval on every rolling-preset tick.
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [filter, activePreset])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user