Skip to content

fix(citations): keep content visible during refetch - #775

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
BharadwajKanneveti:fix/citiations-content-visible-refetch
Aug 23, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
BharadwajKanneveti:fix/citiations-content-visible-refetch

Conversation

@BharadwajKanneveti

Copy link
Copy Markdown
Contributor

Summary

Updated the Citations page so existing content remains visible while citation data is being refetched.

Previously, every filter/date change replaced the page content with the full skeleton. Now:

  • The skeleton is shown only during the initial load.
  • During refetches, the existing data stays mounted.
  • Existing content is dimmed and a loading spinner is displayed over it.
  • Moved brandHasCitations out of loadData so it is fetched once per brand instead of on every filter change.

Related issue

Closes #656

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

Checklist

@gkhngyk

gkhngyk commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

The shape is right — the overlay matches the Insights pattern the issue pointed at, and hoisting brandHasCitations out of the refetch path is exactly the third acceptance criterion.

Two things to fix before merge:

1. The KPI grid and the Sources card lose their spacing. They used to be direct children of the page's space-y-6 container (a fragment adds no DOM node); now they sit two divs deeper, so the 24px gap between them disappears. Insights solves it on the inner wrapper: cn('space-y-6', isRefetching && 'opacity-60').

2. A failing brandHasCitations brings back #599. The new effect has no .catch, and the call now lives outside loadData's try/catch — so a rejection is unhandled, loadFailed never flips, and hasAnyCitations stays null. EmptyRows reads that as "still checking" and both tables sit on the endless "Checking citation data…" spinner, which is the exact case the loadFailed branch was added for. Catching it and surfacing the failure (or at least settling the flag) closes that path.

Two smaller ones while you're in there: const [overview] = await Promise.all([getCitationsOverview(...)]) can be a plain await now that it is a single call, and the <>…</> fragment inside the new wrapper is redundant — the class there can go through cn like the rest of the file.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Marking this as requested changes so it doesn't look ready to merge — the two items above (the lost space-y-6 on the new wrapper, and the uncaught brandHasCitations rejection leaving the tables on the endless "Checking citation data…" spinner) are the blockers. Ping me once they're in and I'll take another look.

@BharadwajKanneveti

Copy link
Copy Markdown
Contributor Author

@gkhngyk I have made the changes please check and let me know if you find any issues

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All four addressed, and the catch does the right thing — settling loadFailed is what keeps the tables off the endless "Checking citation data…" spinner. Thanks!

@gkhngyk
gkhngyk merged commit 14333d9 into ansvisor:main Aug 23, 2026
4 checks passed
Maqbool61 pushed a commit to Maqbool61/ansvisor that referenced this pull request Aug 24, 2026
* fix(citations): keep content visible during refetch

* fix(citations): address review feedback
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.

Citations: keep content visible during refetch instead of swapping the whole page to a skeleton

2 participants