Wildcard: fix createLinkUrl implementation
Created by: oleggromov
Context
In a recent PR refactoring Link components we introduced createLinkUrl
function so that Link users create URL strings themselves. This worked fine but unfortunately, led to bugs such this one because history
's implementation of createPath
thinks that empty pathname == '/'
.
This isn't what we expect when there's no absolute path, similar to <a href='#section'>...</a>
, which is a relative URL.
Solution
Fix the createLinkUrl implementation and add tests.
Test plan
- Pull the branch
- Launch the app
sg start web-standalone
- Open a diff view
- Check that line number URLs are not pointing to a
/#hash
but relative to the current page URL + hash.
App preview:
Check out the client app preview documentation to learn more.