Skip to content

SCIX-831 fix(nav): replace return-to-results with router.back()#812

Merged
thostetler merged 1 commit intoadsabs:masterfrom
thostetler:fix/SCIX-831-go-back
Feb 27, 2026
Merged

SCIX-831 fix(nav): replace return-to-results with router.back()#812
thostetler merged 1 commit intoadsabs:masterfrom
thostetler:fix/SCIX-831-go-back

Conversation

@thostetler
Copy link
Member

The "Return to results" button used latestQuery from Zustand to reconstruct a search URL. This broke when users navigated to an abstract from a non-search context (e.g. a library document list) — the button would route back to a stale earlier search instead of the actual page they came from.

  • Replaced useBackToSearchResults with a minimal hook returning router.back directly
  • Updated all four consumers: SearchBar, authoraffiliations, citation_helper, exportcitation
  • Relabeled button from "Return to results" to "Go back" (destination is now context-dependent)
  • Removed the latestQuery.q !== '' visibility guard — back button always shows on pages that use it
  • exportcitation preserves SimpleLink when an explicit referrer URL is passed from the library
  • New test file for useBackToSearchResults

@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.0%. Comparing base (2c0910b) to head (16aadc1).

Files with missing lines Patch % Lines
src/components/SearchBar/SearchBar.tsx 20.0% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #812     +/-   ##
========================================
+ Coverage    62.0%   62.0%   +0.1%     
========================================
  Files         317     316      -1     
  Lines       36536   36423    -113     
  Branches     1642    1642             
========================================
- Hits        22621   22570     -51     
+ Misses      13878   13816     -62     
  Partials       37      37             
Files with missing lines Coverage Δ
src/lib/useBackToSearchResults.ts 100.0% <100.0%> (+8.4%) ⬆️
src/components/SearchBar/SearchBar.tsx 67.2% <20.0%> (ø)

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@thostetler thostetler merged commit 6fde1a2 into adsabs:master Feb 27, 2026
5 checks passed
@thostetler thostetler deleted the fix/SCIX-831-go-back branch February 27, 2026 22:40
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.

2 participants