Stop (inconsistently) mutating request.url
#10138
aaronadamsCA
started this conversation in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Remix strips its internal params (currently
index
,_data
, and_routes
) fromrequest.url
after callinggetLoadContext()
, but before callingloader()
oraction()
. So the value ofrequest.url
is different depending on where you access it.This is very surprising behaviour that leads to mistakes. It's already caused us issues in two separate apps.
I'd like to suggest a future flag that stops Remix from mutating
request
, and a new way to access the "clean" URL.(request: Request) => URL
.url: URL
togetLoadContext()
,loader()
,action()
, and the others.Notable that @jacob-ebey wrote this a couple of years back:
remix/packages/remix-server-runtime/data.ts
Lines 116 to 120 in d7f4015
Related discussion: #9058
Beta Was this translation helpful? Give feedback.
All reactions