The <Link /> component treats all URLs as local routing paths #4888
Replies: 5 comments 11 replies
-
I think @brophdawg11 recently worked on this on the router (unless I'm confusing with redirects?) |
Beta Was this translation helpful? Give feedback.
-
sigh ... yeah, we should probably just update Maybe we could warn when someone renders an external link? And say something like "hey, just so you know, you could use a regular |
Beta Was this translation helpful? Give feedback.
-
I wrote myself a small package (remix-isomorphic-link) when I ran into the same issue. I agree that a wrapper is necessary in some cases (like parsing markdown at runtime where you have both internal and external links). |
Beta Was this translation helpful? Give feedback.
-
Until Remix supports external URLs in |
Beta Was this translation helpful? Give feedback.
-
Update: This feature has landed in v1.12 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
If I pass full URLs (say
https://www.external.com
ormailto:[email protected]
) to the<Link/>
component'sto=""
prop, those URLs get treated like local routing paths beginning with some weird folder named "https:" or "mailto:[…]".This means that in each project I have to create a wrapper to handle this.
Next.js used to have this exact same problem, but they seem to have fixed it, at least as early as in version 11.
(NOTE: This affects all Remix versions i've tried, up to and including v1.8.2)
EDIT:
I understand the intent of the
<Link/>
component is to handle internal routing magic, but it's still prefectly predictable that users are, more often than not, working with a mixture of local and external URLs, with a few non-HTTP URIs mixed in too.The workaround is easy (as illustrated above) but feels like bothersome busywork.
Baking this into the
<Link/>
component seems like such an easy win for Remix.Beta Was this translation helpful? Give feedback.
All reactions