Skip to content

feat(legacy): resolve BBB hash routes on the client - #982

Open
thostetler wants to merge 4 commits into
masterfrom
fix/legacy-bbb-links
Open

thostetler wants to merge 4 commits into
masterfrom
fix/legacy-bbb-links

Conversation

@thostetler

Copy link
Copy Markdown
Member

Legacy Bumblebee links put the route after a # (e.g. #abs//metrics),
which browsers never send to the server, so these links landed on the home
page instead of the record. They now resolve client-side, with a brief
"This link has moved" notice while the redirect runs.

  • The legacy /search redirect also dropped a trailing sub-route (e.g. /metrics)
    and ignored BBB's p_ page index; both now carry through correctly.
  • /abs/:id/figures now redirects to /abs/:id/graphics.

Bumblebee put the route after the hash (#abs/<bibcode>/metrics), and a
fragment never reaches the server, so every one of these links landed on
the home page instead of the record. LegacyHashRedirect parses the hash
client-side and replaces the location; a pre-hydration script in _document
hides the page and shows "This link has moved..." in the meantime,
clearing itself after 6s regardless.
/search/q=foo/metrics redirected to plain /search and dropped the
/metrics sub-route, and p_ (BBB's zero-based page index) passed through
unmodified instead of becoming the 1-based p param the app reads. It now
also recognizes BBB's show-* and export-* suffixes, translating them to
the same sub-routes the hash-based redirect uses.
Bumblebee called this view figures; a direct link to /abs/:id/figures
404ed without this redirect.
@thostetler
thostetler marked this pull request as ready for review November 19, 2026 05:37
@github-actions

Copy link
Copy Markdown
Contributor

Bundle size

Shared by all pages: 634.0 kB (+1.4 kB) 🔴

Route Base Head Change
/ 697.3 kB 698.7 kB +1.4 kB 🔴
/_error 635.1 kB 636.5 kB +1.4 kB 🔴
/browse 838.4 kB 839.8 kB +1.4 kB 🔴
/browse/[collection] 704.4 kB 705.8 kB +1.4 kB 🔴
/classic-form 709.3 kB 710.6 kB +1.4 kB 🔴
/historical 650.3 kB 651.7 kB +1.4 kB 🔴
/journalsdb/[[...bibstem]] 642.3 kB 643.7 kB +1.4 kB 🔴
/not-implemented 633.1 kB 634.5 kB +1.4 kB 🔴
/paper-form 688.0 kB 689.4 kB +1.4 kB 🔴
/public-libraries/[[...id]] 1073.3 kB 1074.6 kB +1.4 kB 🔴
/search 1096.8 kB 1098.2 kB +1.4 kB 🔴
/search/authoraffiliations 679.6 kB 681.0 kB +1.4 kB 🔴
/search/citation_helper 1076.3 kB 1077.7 kB +1.4 kB 🔴
/search/exportcitation/[format] 744.1 kB 745.5 kB +1.4 kB 🔴
/user/account/forgotpassword 647.5 kB 648.9 kB +1.4 kB 🔴
/user/account/login 639.9 kB 641.3 kB +1.4 kB 🔴
/user/account/register 650.8 kB 652.1 kB +1.4 kB 🔴
/user/account/verify/reset-password/[[...verifyToken]] 649.5 kB 650.9 kB +1.4 kB 🔴
/user/libraries/[[...id]] 1073.4 kB 1074.8 kB +1.4 kB 🔴
/user/notifications 693.9 kB 695.3 kB +1.4 kB 🔴
/user/orcid 647.3 kB 648.7 kB +1.4 kB 🔴
/user/orcid/OAuth 635.4 kB 636.8 kB +1.4 kB 🔴
/abs/[id]/abstract 1120.4 kB 1121.8 kB +1.4 kB 🔴
/abs/[id]/citations 1069.5 kB 1070.9 kB +1.4 kB 🔴
/abs/[id]/coreads 1069.5 kB 1070.9 kB +1.4 kB 🔴
/abs/[id]/credits 1069.5 kB 1070.9 kB +1.4 kB 🔴
/abs/[id]/exportcitation/[format] 793.0 kB 794.4 kB +1.4 kB 🔴
/abs/[id]/graphics 752.2 kB 753.6 kB +1.4 kB 🔴
/abs/[id]/mentions 1069.5 kB 1070.8 kB +1.4 kB 🔴
/abs/[id]/metrics 962.3 kB 963.7 kB +1.4 kB 🔴

…and 22 more routes changed.

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

@codecov

codecov Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.50350% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.6%. Comparing base (2a6c3d3) to head (8244520).

Files with missing lines Patch % Lines
src/lib/legacyRoutes.ts 96.7% 3 Missing and 1 partial ⚠️
src/components/Layout/AbsLayout.tsx 50.0% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #982     +/-   ##
========================================
+ Coverage    57.2%   57.6%   +0.5%     
========================================
  Files         402     405      +3     
  Lines       12512   12648    +136     
  Branches     2816    2849     +33     
========================================
+ Hits         7147    7285    +138     
+ Misses       4691    4688      -3     
- Partials      674     675      +1     
Files with missing lines Coverage Δ
...mponents/LegacyHashRedirect/LegacyHashRedirect.tsx 100.0% <100.0%> (ø)
src/legacy-hash-snippet.ts 100.0% <100.0%> (ø)
src/middleware.ts 94.0% <100.0%> (ø)
src/middlewares/legacySearchURLMiddleware.ts 95.3% <100.0%> (ø)
src/components/Layout/AbsLayout.tsx 11.8% <50.0%> (+5.9%) ⬆️
src/lib/legacyRoutes.ts 96.7% <96.7%> (ø)

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

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Tests Failed

🎭 Some E2E tests failed.

📎 Test artifacts are available in the workflow run

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.

2 participants