Repository navigation
feat(competitors): add date range filter to Competitors page - #1241
Conversation
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
gkhngyk
left a comment
There was a problem hiding this comment.
Thanks. Moving getDateRange out of Insights keeps both pages on the same logic, and 30 days stays the default.
All time: I timed it on our largest brand. competitor_aggregates_daily with no day bounds takes 2.4 s, against 0.6 s for 30 days and 1.6 s for 90, so All time can stay.
One change before merge:
Custom with empty dates reads all time. Choosing Custom reloads at once with empty from/to, and getDateRange returns { dayFrom: undefined, dayTo: undefined }, which is the unbounded read. Meanwhile the caption says "Scores reflect the selected date range". A range with only a "to" date does the same. Don't fetch for Custom until both dates are set, and keep the current data meanwhile.
Smaller:
- Keep the range in the URL, as Insights does (
preset,from,to). The page already keeps?competitor=. getCompetitorsrefetches on every range change, though the list doesn't depend on the range.
|
Maintainer follow-up addressed on the current branch.
Latest CI run #2384 passed web format/lint/typecheck/tests, server lint/format/tests, and schema consistency. |
Summary
getDateRangehelper and always passdays(includingdays: {}for all-time) so benchmark queries continue using the daily rollups instead of scanning all raw rows.Related issue
Closes #892
Type of change
Checklist
feature/)yarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)Formatting passed locally. Web lint, typecheck and build need confirmation from the GitHub Actions run.