Repository navigation
Conversation
Live mode refreshed at the date range's auto granularity only. The Live button is now a split button whose menu offers 30s up to that default. Co-authored-by: Mike Shi <mike@hyperdx.io>
Co-authored-by: Mike Shi <mike@hyperdx.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 726b2e4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review
2 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 1 P3 1 posted as inline comment(s) on the changed lines. 1 P3 folded at the bottom. 🔵 1 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. No P0/P1 defects: the fixed-vs-auto fallback, the 🟡 P2 -- recommended
🔵 P3 nitpicks (4)
Reviewers (8): correctness, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, adversarial, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
E2E Test Results❌ 1 test failed • 472 passed • 1 skipped • 1061s
Tests ran across 4 shards in parallel. |
Every listed interval, including the date range's default, is now a fixed choice. Auto is a separate first item. Co-authored-by: Mike Shi <mike@hyperdx.io>
| defaultInterval: Granularity, | ||
| ): Granularity[] { | ||
| const maxSeconds = convertGranularityToSeconds(defaultInterval); | ||
| if (maxSeconds < MIN_REFRESH_INTERVAL_SECONDS) { |
There was a problem hiding this comment.
🟡 P2 — Ranges of 15 minutes or less offer a fixed 15s interval that goes below the 30s floor, not 'auto only'
When the default is below MIN_REFRESH_INTERVAL_SECONDS, getRefreshIntervalOptions returns [defaultInterval]. DashboardLiveButton then renders it as a separate fixed item under 'Auto (15s)'. If the user picks it, selectedRefreshInterval becomes 15s and the trigger reads '15s', so the user has pinned a 15s refresh. The PR description says auto should be the only choice in this case. Fix: return [] here so only Auto is shown and no 15s selection can be stored. Then update the keeps a default faster than 30s test, which currently locks in the wrong behaviour.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Fixed in 726b2e4: getRefreshIntervalOptions returns [] when the default is under 30s, so only Auto shows (the divider is hidden too). Test updated, plus a DashboardLiveButton test for the auto-only menu.
| refresh(); | ||
| }, | ||
| convertGranularityToSeconds(granularityOverride) * 1000, | ||
| convertGranularityToSeconds(refreshInterval) * 1000, |
There was a problem hiding this comment.
🟡 P2 — A 30d refresh interval overflows setInterval's 32-bit delay and refreshes in a tight loop
REFRESH_INTERVAL_CHOICES includes ThirtyDay. convertDateRangeToGranularityString returns it for ranges over about 420 days (60 buckets × 7d). 30d is 2,592,000,000 ms, which is above setInterval's limit of 2^31-1 ms, so browsers fire it almost immediately. Each refresh changes searchedTimeRange, which rebuilds refresh and restarts the interval, so the dashboard re-queries continuously. Fix: clamp the delay, e.g. Math.min(seconds * 1000, 2**31 - 1), or cap the choices at 7d.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Fixed in 726b2e4: the delay is clamped to 2^31-1 ms, with a test for a 2-year range (30d auto). This also covers auto mode, which had the same overflow on main.
…elay Ranges of 15 minutes or less now offer only Auto. A 30d interval exceeded setInterval's maximum delay and refreshed in a tight loop. Also derives auto vs fixed once and adds DashboardLiveButton tests. Co-authored-by: Mike Shi <mike@hyperdx.io>
| onClick: () => void; | ||
| }) { | ||
| return ( | ||
| <Menu.Item |
There was a problem hiding this comment.
🟡 P2 — Screen readers can't tell which refresh interval is selected
The selected item is marked only by a visual IconCheck and a data-checked attribute, and assistive tech reads neither. Give each Menu.Item role="menuitemradio" and aria-checked={checked}, and have the tests assert aria-checked instead of data-checked.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Tried this: Mantine's Menu.Item sets role: "menuitem" after spreading props, so role="menuitemradio" is overridden, and aria-checked isn't valid on a plain menuitem. Fixing it means replacing Menu.Item with a custom item, which is more than this PR should take on; leaving it for a maintainer to decide.
Summary
Dashboard live mode always refreshed at the time range's auto granularity: every 30m on a 24-hour range, for example. That is too slow for dashboards watched during an incident, and there was no way to change it.
The Live button is now a split button. The left side still toggles live mode. The right side shows the refresh interval and opens a "Refresh every" menu:
Screenshots or video
How to reproduce
Starting point:
yarn app:dev:localconnected to the demo server, or the Vercel preview.On
main:On this branch:
How to test on Vercel preview
Preview routes: /dashboards
Steps:
data-testid="dashboard-refresh-interval-button".References