Closed dmanto closed 1 year ago
Seems there are some linter failures.
Seems there are some linter failures.
You are right, but these are already in the main branch. Thought core team was working on something else. I didn't change anything as they are unrelated to the issue and I don't know what was the intention of them.
Looks like a new eslint rule was added recently.
Fixed if you rebase.
ctx.urlFor() seems to be broken for a root ("/") named route, like in:
ctx.urlFor('root-route')
would return an empty string (''), instead of a single slash string ('/'). That would end provoking problems with tags liketags.linkTo()
You can reproduce the problem with this simple one-liner:
That will give you a broken html link result of
<a href></a>
instead of the expected<a href="/"></a>
Please consider this PR to fix this issue, it just coerces an empty path to be "/" inside ctx._urlForPath() function.
Upon further consideration, it may be better to ensure that the path is specifically an empty string and not any falsy value. For example,
path = path === '' ? '/' : path;
. I would appreciate your feedback on this.