Skip to content

Commit e564606

Browse files
committed
Edit comments in hashIntegration's parsePath util
1 parent aeb6c07 commit e564606

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/integration.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,15 @@ export function hashIntegration() {
178178
go: delta => window.history.go(delta),
179179
renderPath: path => `#${path}`,
180180
parsePath: str => {
181+
// Get everything after the `#` (by dropping everything before the `#`)
181182
const to = str.replace(/^.*?#/, "");
182-
// Hash-only hrefs like `#foo` from plain anchors will come in as `/#foo` whereas a link to
183-
// `/foo` will be `/#/foo`. Check if the to starts with a `/` and if not append it as a hash
184-
// to the current path so we can handle these in-page anchors correctly.
185183
if (!to.startsWith("/")) {
184+
// We got an in-page heading link.
185+
// Append it to the current path to maintain correct browser behavior.
186186
const [, path = "/"] = window.location.hash.split("#", 2);
187187
return `${path}#${to}`;
188188
}
189-
return to;
189+
return to; // Normal SolidStart <A> link
190190
}
191191
}
192192
);

0 commit comments

Comments
 (0)