Skip to content

feat(insights,citations): keep filters in the URL - #985

Merged
gkhngyk merged 1 commit into
mainfrom
feature/insights-citations-url-filters
Oct 8, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/insights-citations-url-filters

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Insights writes these params to the query string:

  • range, plus from and to for a custom range
  • region, model and topic

Citations writes these, using the names its per-URL detail page already reads through buildCitationDetailHref:

  • preset, plus from and to for a custom range
  • platform and region
  • topic, prompt and scope

How both pages read and write them:

  • Each page has a small filtersFromUrl / writeFiltersToUrl pair.
  • The filters are read once after mount, and the first load waits for them, so a linked view never loads the defaults first.
  • Defaults stay out of the URL, and an unknown range, preset or scope falls back to the default.

Two Insights details:

  • A brand switch still clears region, model and topic. The first brand no longer does, so linked filters survive the initial load.
  • The post-payment ?jobId= cleanup used to wipe the whole query string. It now removes only jobId.

Related issue

Closes #917

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. On Insights, pick a 7d range, a model, a region and a topic. Refresh, and the same view loads with a single load.
  2. Switch brands. Region, model and topic clear as before.
  3. On Citations, set a preset, a platform, a prompt and the source scope. Refresh, and they persist.
  4. Open a URL's detail from there. It still opens with the same window.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

🤖 Generated with Claude Code

Insights writes its range (with from/to for a custom range), region,
model and topic to the query string; Citations writes its preset, dates,
platform, region, topic, prompt and source scope, under the same names
the per-URL detail page already reads. Both read them back after mount
and wait for them before the first load, so a linked view never loads
the defaults first. Defaults stay out of the URL and unknown values fall
back to them. On Insights, a brand switch still clears the brand-specific
filters but the first brand keeps the linked ones, and the post-payment
jobId cleanup now removes only that param.

Closes #917
@gkhngyk gkhngyk self-assigned this Oct 8, 2026
@gkhngyk
gkhngyk merged commit 69c4e5f into main Oct 8, 2026
6 checks passed
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.

feat(insights,citations): keep filters in the URL

1 participant