refactor(site): drop redundant window. prefix on browser globals (#24500)

This commit is contained in:
Kayla はな
2026-04-27 15:06:39 -06:00
committed by GitHub
parent a8e7f329ac
commit d78a78ffa1
21 changed files with 29 additions and 26 deletions
+1 -1
View File
@@ -138,7 +138,7 @@ export const getAppHref = (
}
if (host && app.subdomain && app.subdomain_name) {
const baseUrl = `${window.location.protocol}//${host.replace(/\*/g, app.subdomain_name)}`;
const baseUrl = `${location.protocol}//${host.replace(/\*/g, app.subdomain_name)}`;
const url = new URL(baseUrl);
url.pathname = "/";
return url.toString();
@@ -335,7 +335,7 @@ const UserSettingsSub: FC<UserSettingsSubProps> = ({
export const includeOrigin = (target: string): string => {
if (target.startsWith("/")) {
const baseUrl = window.location.origin;
const baseUrl = location.origin;
return `${baseUrl}${target}`;
}
return target;
@@ -236,7 +236,7 @@ const TaskSidebarMenuItem: FC<TaskSidebarMenuItemProps> = ({ task }) => {
<RouterLink
to={{
pathname: `/tasks/${task.owner_name}/${task.id}`,
search: window.location.search,
search: location.search,
}}
>
<TaskSidebarMenuItemStatus task={task} />
@@ -65,7 +65,7 @@ export const TemplateFiles: FC<TemplateFilesProps> = ({
<TemplateFileTree
fileTree={fileTree}
onSelect={(path: string) => {
window.location.hash = path;
location.hash = path;
document.getElementById(path)?.scrollIntoView({
behavior: "smooth",
block: "start",
@@ -195,7 +195,7 @@ const RefreshSessionButton: FC = () => {
size="sm"
onClick={() => {
setIsRefreshing(true);
window.location.reload();
location.reload();
}}
>
<RefreshCwIcon className={cn(isRefreshing && "animate-spin")} />