Skip to content

fix: use request.url instead of global.location in authenticatedLoader#193

Open
arbrandes wants to merge 1 commit intoopenedx:mainfrom
arbrandes:fix-authenticated-loader
Open

fix: use request.url instead of global.location in authenticatedLoader#193
arbrandes wants to merge 1 commit intoopenedx:mainfrom
arbrandes:fix-authenticated-loader

Conversation

@arbrandes
Copy link
Contributor

@arbrandes arbrandes commented Mar 17, 2026

Description

During client-side navigation (e.g. via <Navigate>), React Router runs loaders before committing the new URL to the browser. This means global.location.pathname still reflects the previous page, causing the ?next= parameter to point to the wrong route. Use the request object that React Router passes to loaders instead, which always contains the correct destination URL.

LLM usage notice

Built with assistance from Claude models (mostly Opus 4.6).

During client-side navigation (e.g. via <Navigate>), React Router runs
loaders before committing the new URL to the browser.  This means
global.location.pathname still reflects the previous page, causing the
?next= parameter to point to the wrong route.  Use the request object
that React Router passes to loaders instead, which always contains the
correct destination URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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