Skip to content

Commit

Permalink
Avoid unintentional fetcher configuration blowing up code in web work…
Browse files Browse the repository at this point in the history
…er -- todo, untangle this and avoid the side effect.
  • Loading branch information
dannon committed Aug 6, 2024
1 parent 450de78 commit 4036113
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/src/onload/getRootFromIndexLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { serverPath } from "@/utils/serverPath";
* @returns {string}
*/
export function getRootFromIndexLink(defaultRoot = "/"): string {
if (typeof document === "undefined") {
return defaultRoot;
}
const links = document.getElementsByTagName("link");
const indexLink = Array.from(links).find((link) => link.rel == "index");
return indexLink && indexLink.href ? serverPath(indexLink.href) : defaultRoot;
Expand Down

0 comments on commit 4036113

Please sign in to comment.