Skip to content

fix(sort): stop unlisted sort fields from crashing /search - #994

Open
thostetler wants to merge 2 commits into
adsabs:masterfrom
thostetler:fix/search-sort-unlisted-field-500
Open

thostetler wants to merge 2 commits into
adsabs:masterfrom
thostetler:fix/search-sort-unlisted-field-500

Conversation

@thostetler

Copy link
Copy Markdown
Member

Search URLs sorting by bibcode, classic_factor or id returned a 500 instead of results.

  • Those three fields pass URL sort validation but are not among the nine the sort dropdown offers, so the no-JS control's lookup missed and reading .label off it threw on every server render.
  • The dropdown still offers the same nine sorts; an unlisted sort now renders its field name as the current label rather than crashing.

@thostetler
thostetler requested a review from shinyichen December 1, 2026 17:56
@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Bundle size

Shared by all pages: 643.7 kB (+0.0 kB) ⚪

No route changed by more than 1 kB. ✅

First load = polyfills + shared _app chunks + route chunks, gzipped.

@thostetler
thostetler marked this pull request as ready for review December 2, 2026 13:32
solrSorts accepts 24 values while solrSortOptions offers 9, so bibcode,
classic_factor and id survive URL validation and then miss the dropdown
lookup. NoJsSort read .label off that miss and threw during SSR, serving
a 500 for any link carrying one of those sorts.
@thostetler
thostetler force-pushed the fix/search-sort-unlisted-field-500 branch from c0e5237 to ca2ccc3 Compare December 2, 2026 19:00
@codecov

codecov Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 58.3%. Comparing base (8ea152a) to head (2454946).

Files with missing lines Patch % Lines
src/components/Sort/model.ts 75.0% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #994     +/-   ##
========================================
+ Coverage    58.3%   58.3%   +0.1%     
========================================
  Files         407     407             
  Lines       12768   12772      +4     
  Branches     2863    2864      +1     
========================================
+ Hits         7434    7440      +6     
+ Misses       4648    4647      -1     
+ Partials      686     685      -1     
Files with missing lines Coverage Δ
src/components/Sort/Sort.tsx 86.4% <100.0%> (+4.6%) ⬆️
src/components/Sort/model.ts 83.4% <75.0%> (-16.6%) ⬇️

... 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.

This branch has not been deployed

No deployments
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.

1 participant