react-dev-overlay renders potentially broken URLs
Unanswered
Cape horse mackerel posted this in #help-forum
Cape horse mackerelOP
Hey everyone. New here, popped in because I found an issue and I'm kind of battling where we think the issue should be fixed.
Here is a codesandbox example:
https://codesandbox.io/p/sandbox/period-being-accounted-for-in-nextjs-error-overlay-l3qjw2?file=/pages/index.tsx:12,1
What this is is a basic demo of NextJS and react-router-dom. What happens is react-router-dom has thrown an error, and Next in their Error overlay have added the ability to make links clickable. That code is here - https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/react-dev-overlay/internal/components/hot-linked-text/index.tsx
The link though that is raised by react-router-dom is actually broken, and it's because of the trailing period. So I investigated where the period came from and it comes from react-router-dom. The error message has a trailing period.
So I've battled back and forth where it should be fixed.
Fix in NextJS
I don't want to say having a trailing period is an invalid URL. Domains can have trailing periods and servers can handle requests with trailing periods
http://www.dns-sd.org/trailingdotsindomainnames.html
https://webmasters.stackexchange.com/questions/50312/redirect-url-ending-with-dot
Fix in react-router-dom
Fixing it there is simple and quick
They supplied the URL, so it's on them kind of
This doesn't fix the issue globally though, guaranteed others do the same. It's such an easy thing to overlook. This is not solely a react-router-dom issue.
Here is a codesandbox example:
https://codesandbox.io/p/sandbox/period-being-accounted-for-in-nextjs-error-overlay-l3qjw2?file=/pages/index.tsx:12,1
What this is is a basic demo of NextJS and react-router-dom. What happens is react-router-dom has thrown an error, and Next in their Error overlay have added the ability to make links clickable. That code is here - https://github.com/vercel/next.js/blob/canary/packages/next/src/client/components/react-dev-overlay/internal/components/hot-linked-text/index.tsx
The link though that is raised by react-router-dom is actually broken, and it's because of the trailing period. So I investigated where the period came from and it comes from react-router-dom. The error message has a trailing period.
So I've battled back and forth where it should be fixed.
Fix in NextJS
I don't want to say having a trailing period is an invalid URL. Domains can have trailing periods and servers can handle requests with trailing periods
http://www.dns-sd.org/trailingdotsindomainnames.html
https://webmasters.stackexchange.com/questions/50312/redirect-url-ending-with-dot
Fix in react-router-dom
Fixing it there is simple and quick
They supplied the URL, so it's on them kind of
This doesn't fix the issue globally though, guaranteed others do the same. It's such an easy thing to overlook. This is not solely a react-router-dom issue.
1 Reply
Cape horse mackerelOP
Forget that this is react-router-dom. The point is that any error thrown that contains a URL that has a period at the end is potentially just a broken link.