fix(marketing): preserve leaderboard browser history

Merged
HA
2mo ago
+1-1

What & why

Clicking a leaderboard user changes the route to their profile. Pressing Back restored /leaderboard in the URL but left the profile visible because the leaderboard's query-string sync replaced Next.js's history state with null.

Preserve the current history state when syncing the leaderboard search query.

How I tested it

  • Ran the local marketing app with NEXT_PUBLIC_API_URL pointed at the public API (https://api.superset.sh); the leaderboard loaded 50 public rows. Clicked a profile and pressed Back; the leaderboard URL and page were restored.
  • bun run --filter=@superset/marketing typecheck passed.
  • Targeted Biome check and git diff --check passed.

Checklist

  • PR title follows conventional commits (type(scope): subject)
  • bun run lint and bun run typecheck pass (full bun run lint was not run)
  • "Allow edits from maintainers" is enabled

Summary by cubic

Fixes the leaderboard back button so pressing Back after clicking a user restores both the URL and the page. The leaderboard's search query sync was passing null to history.replaceState, which replaced Next.js's history state. It now passes window.history.state to preserve that state.

Summary by CodeRabbit

  • Bug Fixes
    • Preserved browser history state when updating the leaderboard search URL.