Fix a bug when link to Home doesn't work on a published site (#1503)

## Description

Context:
https://discord.com/channels/955905230107738152/1098457250235957258

Fix of the bug: on a published site, when you point a link to Page=Home,
the rendered `href` contains path of the current page.

This is most likely due to `homePage.path === ""` and when we pass
`to=""` to RemixLink it behaves like this.

So I made sure we pass `to="/"` for the home page.
This commit is contained in:
Roman Pominov authored and GitHub committed 2023-04-20 16:36:38 +03:00
1 parent 723d9e2f20
commit 037d35162c
2 files changed
+2 -2

No files matched your search

@@ -12,7 +12,7 @@ export const wrapLinkComponent = (BaseLink: LinkComponent) => {
const href = usePropUrl(getInstanceIdFromComponentProps(props), "href");
if (href?.type === "page") {
let to = href.page.path;
let to = href.page.path === "" ? "/" : href.page.path;
if (href.hash !== undefined) {
to += `#${href.hash}`;
}
+1 -1
View File
@@ -23,7 +23,7 @@ export const Link = forwardRef<HTMLAnchorElement, Props>((props, ref) => {
switch (href?.type) {
case "page":
url = href.page.path;
url = href.page.path === "" ? "/" : href.page.path;
if (href.hash !== undefined) {
url += `#${href.hash}`;
}