π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
[WEB-2559] fix: live server URL generation for self-managed instances. (#5733)
Prateek Shourya62c45f3bb15b
diff --git a/web/core/components/pages/editor/editor-body.tsx b/web/core/components/pages/editor/editor-body.tsxindex 99b261e79c..c4efaac7bf 100644--- a/web/core/components/pages/editor/editor-body.tsx+++ b/web/core/components/pages/editor/editor-body.tsx@@ -18,7 +18,7 @@ import { IUserLite } from "@plane/types";import { Row } from "@plane/ui";import { PageContentBrowser, PageContentLoader, PageEditorTitle } from "@/components/pages";// helpers-import { cn, LIVE_URL } from "@/helpers/common.helper";+import { cn, LIVE_BASE_PATH, LIVE_BASE_URL } from "@/helpers/common.helper";import { generateRandomColor } from "@/helpers/string.helper";// hooksimport { useMember, useMention, useUser, useWorkspace } from "@/hooks/store";@@ -112,24 +112,30 @@ export const PageEditorBody: React.FC<Props> = observer((props) => {[]);- const realtimeConfig: TRealtimeConfig = useMemo(() => {+ const realtimeConfig: TRealtimeConfig | undefined = useMemo(() => {// Construct the WebSocket Collaboration URL- const WS_LIVE_URL = new URL(LIVE_URL);- const isSecureEnvironment = window.location.protocol === "https:";- WS_LIVE_URL.protocol = isSecureEnvironment ? "wss" : "ws";- WS_LIVE_URL.pathname = "collaboration";-- return {- url: WS_LIVE_URL.toString(),- queryParams: {- workspaceSlug: workspaceSlug?.toString(),- projectId: projectId?.toString(),- documentType: "project_page",- },- };+ try {+ const LIVE_SERVER_BASE_URL = LIVE_BASE_URL ?? window.location.origin;+ const WS_LIVE_URL = new URL(`${LIVE_SERVER_BASE_URL}${LIVE_BASE_PATH}`);+ const isSecureEnvironment = window.location.protocol === "https:";+ WS_LIVE_URL.protocol = isSecureEnvironment ? "wss" : "ws";+ WS_LIVE_URL.pathname = "collaboration";+ // Construct realtime config+ return {+ url: WS_LIVE_URL.toString(),+ queryParams: {+ workspaceSlug: workspaceSlug?.toString(),+ projectId: projectId?.toString(),+ documentType: "project_page",+ },+ };+ } catch (error) {+ console.error("Error creating realtime config", error);+ return undefined;+ }}, [projectId, workspaceSlug]);- if (pageId === undefined) return <PageContentLoader />;+ if (pageId === undefined || !realtimeConfig) return <PageContentLoader />;return (<div className="flex items-center h-full w-full overflow-y-auto">diff --git a/web/helpers/common.helper.ts b/web/helpers/common.helper.tsindex 5113322166..144c896832 100644--- a/web/helpers/common.helper.ts+++ b/web/helpers/common.helper.ts@@ -9,7 +9,7 @@ export const ADMIN_BASE_PATH = process.env.NEXT_PUBLIC_ADMIN_BASE_PATH || "";export const SPACE_BASE_URL = process.env.NEXT_PUBLIC_SPACE_BASE_URL || "";export const SPACE_BASE_PATH = process.env.NEXT_PUBLIC_SPACE_BASE_PATH || "";-const LIVE_BASE_URL = process.env.NEXT_PUBLIC_LIVE_BASE_URL || "";+export const LIVE_BASE_URL = process.env.NEXT_PUBLIC_LIVE_BASE_URL || "";export const LIVE_BASE_PATH = process.env.NEXT_PUBLIC_LIVE_BASE_PATH || "";export const LIVE_URL = `${LIVE_BASE_URL}${LIVE_BASE_PATH}`;