feat(ui): extend self-hosted max pickable days#114402
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
This issue has gone three weeks without activity. In another week, I will close it. But! If you comment or otherwise update it, I will reset the clock, and if you remove the label "A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀 |
| (() => MAX_PICKABLE_DAYS); | ||
| const maxRetentionDays = useGetMaxRetentionDays(); | ||
| (() => defaultMaxPickableDays); | ||
| const maxRetentionDays = useGetMaxRetentionDays() ?? defaultMaxPickableDays; |
There was a problem hiding this comment.
Bug: useGroupDefaultStatsPeriod can return an incorrect '90d' stats period on initial load for SaaS organizations with less than 90 days retention, due to a non-reactive useGetMaxRetentionDays hook.
Severity: MEDIUM
Suggested Fix
Make useGetMaxRetentionDays reactive to changes in the SubscriptionStore. This can be achieved by using a hook like useStoreState or adding a listener to ensure the component re-renders when subscription data becomes available. This will prevent the initial fallback value from persisting incorrectly.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: static/app/views/issueDetails/useGroupDefaultStatsPeriod.tsx#L44
Potential issue: On SaaS, `useGetMaxRetentionDays()` can return `undefined` while
subscription data is loading. The new `?? defaultMaxPickableDays` coercion sets
`maxRetentionDays` to 90. This causes `useGroupDefaultStatsPeriod` to return a '90d'
stats period for organizations with retention less than 90 days. Because
`useGetMaxRetentionDays` is not reactive and reads from the store synchronously, the
component does not update when subscription data loads. This results in the incorrect
'90d' period persisting, leading to API queries for data outside the plan's retention
window.
Did we get this right? 👍 / 👎 to inform future reviews.
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.
Reviewed by Cursor Bugbot for commit a2b4572. Configure here.
| '14d': t('Last 14 days'), | ||
| '30d': t('Last 30 days'), | ||
| '90d': t('Last 90 days'), | ||
| '180d': t('Last 180 days'), |
There was a problem hiding this comment.
Unfiltered 180d option leaks through relativeOptions callbacks
Medium Severity
Adding 180d unconditionally to DEFAULT_RELATIVE_PERIODS causes it to leak into TimeRangeSelector consumers that use relativeOptions as a function callback. The restrictedDefaultPeriods filtering (which respects maxPickableDays) only applies when relativeOptions is not a function. When it is a function, the raw unfiltered DEFAULT_RELATIVE_PERIODS is passed as defaultOptions. Callers like eventDetailsHeader.tsx and releases/detail/overview/index.tsx spread props.defaultOptions directly, so "Last 180 days" will appear on SaaS where maxPickableDays is 90.
Reviewed by Cursor Bugbot for commit a2b4572. Configure here.


Summary
static/appmax pickable day default resolve to 180 days for self-hosted orgs withvisibility-increased-max-pickable-days180drelative option and reuse the self-hosted-aware default across shared picker consumersDepends on #114401
Refs #94602
Refs #105899