Fix #129: handle relative paths on links and route calls#243
Fix #129: handle relative paths on links and route calls#243ashsearle wants to merge 5 commits intopreactjs:mainfrom
Conversation
| a.setAttribute('href', url); | ||
| url = a.href; | ||
| } | ||
| let [,protocol,host,pathname,search,hash] = uriRegex.exec(url); |
There was a problem hiding this comment.
Could we skip the parse entirely and just do this?
return a.pathname + a.search + a.hash;There was a problem hiding this comment.
I may have been worrying about server-side (nodejs) rendering where we don't have an a to do URL resolution: is that a valid concern?
If not, I'll happily simplify.
There was a problem hiding this comment.
I think we can probably skip the SSR concern for now - route() should be a no-op there anyway since SSR is single-pass.
|
@developit Any plans to merge this? |
|
@developit can i help for this PR ? I need it badly 😅 |
|
|
||
| // attempt to route, if no match simply cede control to browser | ||
| return route(href); | ||
| return route(node.pathname + node.search + node.hash); |
There was a problem hiding this comment.
I think this could use node.href.
There was a problem hiding this comment.
It's been a while since I wrote this, but think the reason I did this was for some sort of consistency with getCurrentUrl (which omits protocol/host/port)
Reimplement #138 with clean commit history, but bringing in changes from #177 too.