Skip to content

Citations: default the date filter to 24h instead of All #485

Closed

Description

@gkhngyk

Problem

The Citations page (web/src/app/[locale]/(dashboard)/dashboard/citations/page.tsx) opens with datePreset: 'all' (DEFAULT_FILTERS, ~line 214) while Insights opens with '24h'. Two problems:

  1. Inconsistency — the two most-visited analytical pages answer "what period am I looking at?" differently by default, so numbers glanced across pages don't line up.
  2. Cost — 'all' is the heaviest possible default: every first load scans the brand's entire citation history before the user has asked for it. On busy brands that is the largest window the page can ever query, paid on 100% of visits.

Fix

  • Change DEFAULT_FILTERS.datePreset from 'all' to '24h', matching Insights.
  • Required companion — a period-aware empty state: today the page has only a generic "No citations match your filters" message. A brand whose tracking runs less often than daily would now open to an empty page by default. Mirror the Insights pattern (NoDataForPeriod): when the selected window has no citations but the brand has citation data outside it, say so ("No citations in the last 24 hours") and offer a one-click Show all data reset. Distinguishing "no data in window" from "no data at all" needs a cheap unfiltered existence check — Insights' checkUnfiltered/getBrandResultsTotal approach in web/src/lib/actions/tracking.ts is the reference (count query, no rows).

Acceptance criteria

  • A cold load of /dashboard/citations shows the 24h window selected and 24h-scoped data.
  • With citations outside the window but none inside it, the page shows the period-aware empty state with a working "Show all data" reset — not the generic filter message and not a bare empty table.
  • With no citations at all, the existing brand-level empty state still shows.
  • All other presets (7d/30d/90d/all/custom) keep working unchanged.
  • yarn lint, yarn typecheck, yarn format:check pass from web/.

Getting started

See CONTRIBUTING.md for setup. Comment here to claim the issue before opening a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions