Skip to content

Wildcard: fix createLinkUrl implementation

Administrator requested to merge og/create-link-url-fix into main

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

  1. Pull the branch
  2. Launch the app sg start web-standalone
  3. Open a diff view
  4. 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.

Merge request reports

Loading