Skip to content

Commit 1339a81

Browse files
Fixes.
1 parent 2fce516 commit 1339a81

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/language-server/pyright.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export const pyright = (language: string): LanguageServerClient | undefined => {
2424
return undefined;
2525
}
2626
// Needed to support review branches that use a path location.
27-
const { origin, pathname } = window.location;
28-
const base = `${origin}${pathname}${pathname.endsWith("/") ? "" : "/"}`;
29-
const workerScript = `${base}workers/${workerScriptName}`;
27+
const workerScript = `${
28+
process.env.PUBLIC_URL || "/"
29+
}workers/${workerScriptName}`;
3030
const foreground = new Worker(workerScript, {
3131
name: "Pyright-foreground",
3232
});

src/router-hooks.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const parse = (pathname: string, search: string): RouterState => {
7979
idea: anchorForParam(params.get("idea")),
8080
};
8181
}
82-
const base = process.env.PUBLIC_URL ?? "/";
82+
const base = process.env.PUBLIC_URL || "/";
8383
pathname = pathname.slice(base.length);
8484
if (pathname) {
8585
const parts = pathname.split("/");
@@ -88,11 +88,11 @@ const parse = (pathname: string, search: string): RouterState => {
8888
case "api":
8989
return { tab: "api", api: anchorForParam(parts[1]) };
9090
case "reference":
91-
return { tab: "reference", api: anchorForParam(parts[1]) };
91+
return { tab: "reference", reference: anchorForParam(parts[1]) };
9292
case "idea":
93-
return { tab: "ideas", api: anchorForParam(parts[1]) };
93+
return { tab: "ideas", idea: anchorForParam(parts[1]) };
9494
default:
95-
return {};
95+
return { tab };
9696
}
9797
}
9898
return {};
@@ -123,7 +123,7 @@ export const toUrl = (state: RouterState): string => {
123123
(state.idea ? "ideas" : undefined),
124124
state.api?.id ?? state.reference?.id ?? state.idea?.id,
125125
];
126-
const base = process.env.PUBLIC_URL ?? "/";
126+
const base = process.env.PUBLIC_URL || "/";
127127
const pathname = base + parts.filter((x): x is string => !!x).join("/");
128128
return window.location.toString().split("/", 1)[0] + pathname;
129129
};

0 commit comments

Comments
 (0)