ref(aci): Automatically zoom metric issues to the event's open period#109212
ref(aci): Automatically zoom metric issues to the event's open period#109212
Conversation
…ssues Set the event ID in the URL and default statsPeriod to 4h when viewing metric detector triggered issues. Uses useEffectEvent to avoid stale closures while re-running when the event ID changes. Co-Authored-By: Claude <noreply@anthropic.com>
Rename useApplyMetricDetectorDefaults to useZoomTimeRangeToOpenPeriod for clarity, update buildDetectorZoomQuery to accept the zoom range object directly, and fix test router config to use routes array. Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| intervalSeconds={snubaQuery?.timeWindow} | ||
| openPeriodStart={startDate} | ||
| openPeriodEnd={endDate} | ||
| /> |
There was a problem hiding this comment.
Zoom fires before open period data finishes loading
Medium Severity
ZoomToOpenPeriod is rendered unconditionally, so the useEffect fires on mount before the open period API response arrives. At that point, endDate is the fallbackEndDate (current time) because openPeriod is still null. The effect navigates with a zoom range based on Date.now() instead of the real open period end. When the API response updates openPeriodEnd, the effect re-fires but bails out because the first navigation already set time params in the URL. For historical/resolved issues, this produces a much wider zoom window than intended.
Additional Locations (1)
There was a problem hiding this comment.
It only activates if there is a start date which won't happen if there is no api response
…#109212) When a metric issue loads, this will look at the open period start/end times and apply time range filters so that it is centered in the chart. This is a much better user experience than the default 14 days. This will only happen if a time range isn't already present in the URL.
…#109212) When a metric issue loads, this will look at the open period start/end times and apply time range filters so that it is centered in the chart. This is a much better user experience than the default 14 days. This will only happen if a time range isn't already present in the URL.


Closes ISWF-907
When a metric issue loads, this will look at the open period start/end times and apply time range filters so that it is centered in the chart. This is a much better user experience than the default 14 days. This will only happen if a time range isn't already present in the URL.
Before:
After: