Skip to content

fix: charts time filter default state mismatch#600

Merged
samufacanha2 merged 2 commits intodevelopfrom
fix/charts-time-filter-off-by-one
Mar 12, 2026
Merged

fix: charts time filter default state mismatch#600
samufacanha2 merged 2 commits intodevelopfrom
fix/charts-time-filter-off-by-one

Conversation

@ianakiara
Copy link
Member

@ianakiara ianakiara commented Mar 6, 2026

Summary

  • Fix useState(15)useState(16) so the "15D" button is correctly selected on page load
  • The +1 offset on filter buttons is intentional (provides comparison point for chart readability) — left untouched per reviewer feedback

Changes

src/pages/charts/index.tsx

  • const [timeFilter, setTimeFilter] = useState(15)useState(16) to match item + 1 when item = 15

Test plan

  • Open charts page — verify "15D" button is highlighted on load
  • Click each filter button — verify correct selection state
  • Verify chart data loads correctly for all filter options

Closes #598

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Corrected chart time-filter behavior so the initially selected filter matches the displayed time period and initial data fetch. This resolves an off-by-one mismatch that previously showed a different option than the data on first load.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b04298f1-4fd8-4b8c-b1d2-135ccdd7c39b

📥 Commits

Reviewing files that changed from the base of the PR and between 866252e and 1d93569.

📒 Files selected for processing (1)
  • src/pages/charts/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pages/charts/index.tsx

Walkthrough

Initial time filter default changed from 15 to 16 in the charts page, which affects the initial transaction list fetch and causes the 15D button to appear selected on first render.

Changes

Cohort / File(s) Summary
Time Filter Default
src/pages/charts/index.tsx
Changed initial timeFilter value from 15 to 16, altering the initial API call's timeFilter and making the 15D button selected on first render (selection logic and button handlers unchanged).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 I nudged a number, just one more,
Now fifteen shows where it stood before.
A tiny hop, the UI sings,
Buttons, API — aligned little things. 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The PR partially addresses issue #598 but takes a different approach than the suggested fix, choosing to adjust the default state to 16 instead of removing the +1 offset. Clarify whether the +1 offset is intentional for including an extra comparison day; if so, document this design decision and ensure API calls align with the intent.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the primary change: fixing the default state mismatch in the charts time filter.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to the timeFilter initialization only and does not introduce unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/charts-time-filter-off-by-one

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 6, 2026
@codecov
Copy link

codecov bot commented Mar 6, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 0.46%. Comparing base (2e46340) to head (1d93569).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
src/pages/charts/index.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           develop    #600   +/-   ##
=======================================
  Coverage     0.46%   0.46%           
=======================================
  Files          530     530           
  Lines        20953   20953           
  Branches      5257    5257           
=======================================
  Hits            97      97           
  Misses       20044   20044           
  Partials       812     812           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ianakiara ianakiara force-pushed the fix/charts-time-filter-off-by-one branch from 7824b5e to 866252e Compare March 9, 2026 17:05
The +1 offset on filter buttons is intentional — fetching an extra day
provides a comparison point for chart readability (especially for 1D).
Only fix: useState(15) → useState(16) so "15D" is selected on page load.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ianakiara ianakiara changed the title fix: correct charts time filter off-by-one and default state mismatch fix: charts time filter default state mismatch Mar 9, 2026
@samufacanha2 samufacanha2 merged commit 1b40369 into develop Mar 12, 2026
4 of 5 checks passed
@samufacanha2 samufacanha2 deleted the fix/charts-time-filter-off-by-one branch March 12, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Charts page: time filter off-by-one and default state mismatch

2 participants