[GH-ISSUE #9] Bug: Backfill shading missing on 1 week / 1 month when event start is outside visible domain #7

Closed
opened 2026-10-26 22:08:22 +00:00 by bsakaguchi · 1 comment
Owner

Originally created by @benceruleanlu on GitHub (Nov 9, 2025).
Original GitHub issue: https://github.com/Comfy-Org/download-data/issues/9

Summary
Backfill overlay (ReferenceArea) does not render on short ranges (1 week / 1 month) when a backfill event starts before the visible window. It shows on 3 months / all time where the event interval is fully within the X domain.

Cause

  • X-axis is categorical with date strings; ReferenceArea requires x1/x2 values to be present in the domain.
  • Events API includes any event with end_date >= threshold so start_date can be before the window. On 7/30-day windows, e.startDate often isn’t in chartData.map(d => d.date), so the overlay doesn’t render.

Evidence

  • Overlay code: components/charts/daily-downloads-chart.tsx:240-243
    • <ReferenceArea x1={e.startDate} x2={e.endDate} ... />
  • Events filter: app/api/backfill/events/route.ts:56-63 (WHERE end_date >= ?)
  • Example DB event spans outside short windows: backfill_events has 2025-10-06 → 2025-11-03.

Proposed Fix

  • Clamp overlay to visible domain before rendering:
    • visibleStart = chartData[0].date, visibleEnd = chartData[chartData.length - 1].date
    • x1 = max(e.startDate, visibleStart), x2 = min(e.endDate, visibleEnd)
    • Render only if x1 <= x2.
  • Alternative: switch to numeric/time axis (timestamp field + type="number") so off-domain x1/x2 are clipped properly by the scale.

Acceptance Criteria

  • For 1 week and 1 month views, any backfill event overlapping the window shows a shaded area covering the overlap.
  • 3 months / all time remain unchanged.

Notes

  • The midpoint label ("Backfilled (strategy)") can still render because it is clamped to the visible domain separately, which exacerbates the mismatch.
Originally created by @benceruleanlu on GitHub (Nov 9, 2025). Original GitHub issue: https://github.com/Comfy-Org/download-data/issues/9 Summary Backfill overlay (ReferenceArea) does not render on short ranges (1 week / 1 month) when a backfill event starts before the visible window. It shows on 3 months / all time where the event interval is fully within the X domain. Cause - X-axis is categorical with `date` strings; `ReferenceArea` requires `x1`/`x2` values to be present in the domain. - Events API includes any event with `end_date >= threshold` so `start_date` can be before the window. On 7/30-day windows, `e.startDate` often isn’t in `chartData.map(d => d.date)`, so the overlay doesn’t render. Evidence - Overlay code: components/charts/daily-downloads-chart.tsx:240-243 - `<ReferenceArea x1={e.startDate} x2={e.endDate} ... />` - Events filter: app/api/backfill/events/route.ts:56-63 (`WHERE end_date >= ?`) - Example DB event spans outside short windows: backfill_events has 2025-10-06 → 2025-11-03. Proposed Fix - Clamp overlay to visible domain before rendering: - `visibleStart = chartData[0].date`, `visibleEnd = chartData[chartData.length - 1].date` - `x1 = max(e.startDate, visibleStart)`, `x2 = min(e.endDate, visibleEnd)` - Render only if `x1 <= x2`. - Alternative: switch to numeric/time axis (timestamp field + `type="number"`) so off-domain x1/x2 are clipped properly by the scale. Acceptance Criteria - For 1 week and 1 month views, any backfill event overlapping the window shows a shaded area covering the overlap. - 3 months / all time remain unchanged. Notes - The midpoint label ("Backfilled (strategy)") can still render because it is clamped to the visible domain separately, which exacerbates the mismatch.
bsakaguchi 2026-10-26 22:08:22 +00:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@benceruleanlu commented on GitHub (Nov 10, 2025):

Fixed in 561cc12254

<!-- gh-comment-id:3509304732 --> @benceruleanlu commented on GitHub (Nov 10, 2025): Fixed in 561cc12254d456e3ccf06eaa7dd3a110b1ab8851
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/download-data#7
No description provided.