Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

fix: resolve React Doctor errors and restore its PR baseline (#9488)

sriram veeraghanta7564480cf73c
diff --git a/.github/workflows/react-doctor.yml b/.github/workflows/react-doctor.yml
index dc1463d28e..ab65edf473 100644
--- a/.github/workflows/react-doctor.yml
+++ b/.github/workflows/react-doctor.yml
@@ -9,13 +9,13 @@ name: React Doctor
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
- # Scans `main` on every push so you get a health-score trend on the
+ # Scans `preview` on every push so you get a health-score trend on the
# default branch β€” useful for tracking the overall number commit-by-commit
# and catching regressions that slipped past PR review. PR-specific steps
# (the sticky summary comment) are skipped automatically on `push` events.
# Comment this block out if you only want PR-time scans.
push:
- branches: [main]
+ branches: [preview]
permissions:
# `actions/checkout` needs this to read the repo source.
@@ -47,6 +47,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
+ with:
+ # React Doctor diffs the changed files against the merge base so it
+ # only reports what the PR introduces. The default shallow checkout
+ # has no merge base, which makes it fall back to listing every
+ # pre-existing issue in every changed file.
+ fetch-depth: 0
+ # Don't leave the workflow token in .git/config for the third-party
+ # action that runs next. fetch-depth: 0 has already fetched every ref
+ # it needs, and it talks to the API through its own credentials.
+ persist-credentials: false
- uses: millionco/react-doctor@v2
# Common configuration knobs β€” uncomment any to override the default.
diff --git a/apps/web/core/components/estimates/points/preview.tsx b/apps/web/core/components/estimates/points/preview.tsx
index c07038bd90..f7eb22aef1 100644
--- a/apps/web/core/components/estimates/points/preview.tsx
+++ b/apps/web/core/components/estimates/points/preview.tsx
@@ -53,8 +53,15 @@ export const EstimatePointItemPreview = observer(function EstimatePointItemPrevi
const EstimatePointValueRef = useRef<HTMLDivElement>(null);
useEffect(() => {
- if (!estimatePointEditToggle && !estimatePointDeleteToggle)
- EstimatePointValueRef?.current?.addEventListener("dblclick", () => setEstimatePointEditToggle(true));
+ const estimatePointValueElement = EstimatePointValueRef.current;
+ if (!estimatePointValueElement || estimatePointEditToggle || estimatePointDeleteToggle) return;
+
+ const handleDoubleClick = () => setEstimatePointEditToggle(true);
+ estimatePointValueElement.addEventListener("dblclick", handleDoubleClick);
+
+ return () => {
+ estimatePointValueElement.removeEventListener("dblclick", handleDoubleClick);
+ };
}, [estimatePointDeleteToggle, estimatePointEditToggle]);
return (
diff --git a/apps/web/core/components/issues/header.tsx b/apps/web/core/components/issues/header.tsx
index 860611319e..852b53ad52 100644
--- a/apps/web/core/components/issues/header.tsx
+++ b/apps/web/core/components/issues/header.tsx
@@ -55,7 +55,9 @@ export const IssuesHeader = observer(function IssuesHeader() {
const { allowPermissions } = useUserPermissions();
const { isMobile } = usePlatformOS();
- const SPACE_APP_URL = (SPACE_BASE_URL.trim() === "" ? window.location.origin : SPACE_BASE_URL) + SPACE_BASE_PATH;
+ const SPACE_APP_URL =
+ (SPACE_BASE_URL.trim() === "" && typeof window !== "undefined" ? window.location.origin : SPACE_BASE_URL) +
+ SPACE_BASE_PATH;
const publishedURL = `${SPACE_APP_URL}/issues/${currentProjectDetails?.anchor}`;
const issuesCount = getGroupIssueCount(undefined, undefined, false);
diff --git a/apps/web/core/components/issues/issue-layouts/calendar/issue-block.tsx b/apps/web/core/components/issues/issue-layouts/calendar/issue-block.tsx
index e66e35eab3..f8666fdb38 100644
--- a/apps/web/core/components/issues/issue-layouts/calendar/issue-block.tsx
+++ b/apps/web/core/components/issues/issue-layouts/calendar/issue-block.tsx
@@ -58,12 +58,16 @@ export const CalendarIssueBlock = observer(
const projectIdentifier = getProjectIdentifierById(issue?.project_id);
// handlers
- const handleIssuePeekOverview = (issue: TIssue) => handleRedirection(workspaceSlug.toString(), issue, isMobile);
+ const handleIssuePeekOverview = (peekIssue: TIssue) =>
+ handleRedirection(workspaceSlug?.toString(), peekIssue, isMobile);
useOutsideClickDetector(menuActionRef, () => setIsMenuActive(false));
const customActionButton = (
+ // CustomMenu renders this inside its own <button>, which already carries the
+ // interactive semantics and keyboard handling β€” this div is presentational.
<div
+ role="presentation"
ref={menuActionRef}
className={`w-full cursor-pointer rounded-sm p-1 text-placeholder hover:bg-layer-1 ${
isMenuActive ? "bg-layer-1-active text-primary" : "text-secondary"
@@ -75,7 +79,9 @@ export const CalendarIssueBlock = observer(
);
const isMenuActionRefAboveScreenBottom =
- menuActionRef?.current && menuActionRef?.current?.getBoundingClientRect().bottom < window.innerHeight - 220;
+ typeof window !== "undefined" &&
+ menuActionRef?.current &&
+ menuActionRef?.current?.getBoundingClientRect().bottom < window.innerHeight - 220;
const placement = isMenuActionRefAboveScreenBottom ? "bottom-end" : "top-end";
@@ -136,7 +142,10 @@ export const CalendarIssueBlock = observer(
)}
<div className="truncate text-13 font-medium md:text-11 md:font-regular">{issue.name}</div>
</div>
+ {/* Wrapper exists only to stop clicks reaching the ControlLink; the
+ quick-action menu inside carries its own interactive semantics. */}
<div
+ role="presentation"
className={cn("size-5 flex-shrink-0", {
"hidden group-hover/calendar-block:block": !isMobile,
block: isMenuActive,
diff --git a/apps/web/core/components/pages/editor/editor-body.tsx b/apps/web/core/components/pages/editor/editor-body.tsx
index 776e10c91e..d8d55d2f79 100644
--- a/apps/web/core/components/pages/editor/editor-body.tsx
+++ b/apps/web/core/components/pages/editor/editor-body.tsx
@@ -44,7 +44,7 @@ import type { TPageInstance } from "@/store/pages/base-page";
import { PageContentLoader } from "../loaders/page-content-loader";
import { PageEditorHeaderRoot } from "./header";
import { PageContentBrowser } from "./summary";
-import { EditorAIMenu } from "./ai";
+import { EditorAIMenu } from "./ai/menu";
export type TEditorBodyConfig = {
fileHandler: TFileHandler;
@@ -188,6 +188,11 @@ export const PageEditorBody = observer(function PageEditorBody(props: Props) {
);
const realtimeConfig: TRealtimeConfig | undefined = useMemo(() => {
+ // The collaboration URL is derived from window.location, so it can only be
+ // built on the client. There is no socket to connect to during SSR anyway β€”
+ // the config is recomputed on hydration.
+ if (typeof window === "undefined") return undefined;
+
// Construct the WebSocket Collaboration URL
try {
const LIVE_SERVER_BASE_URL = LIVE_BASE_URL?.trim() || window.location.origin;
diff --git a/apps/web/core/hooks/use-keypress.tsx b/apps/web/core/hooks/use-keypress.tsx
index 655b1a8d3d..c3fad814d5 100644
--- a/apps/web/core/hooks/use-keypress.tsx
+++ b/apps/web/core/hooks/use-keypress.tsx
@@ -4,13 +4,21 @@
* See the LICENSE file for details.
*/
-import { useEffect } from "react";
+import { useEffect, useRef } from "react";
const useKeypress = (key: string, callback: (event: KeyboardEvent) => void) => {
+ // Keep the latest callback in a ref so callers can pass an inline arrow
+ // without tearing down and re-adding the document listener every render.
+ const callbackRef = useRef(callback);
+
+ useEffect(() => {
+ callbackRef.current = callback;
+ }, [callback]);
+
useEffect(() => {
const handleKeydown = (event: KeyboardEvent) => {
if (event.key === key) {
- callback(event);
+ callbackRef.current(event);
}
};
@@ -19,7 +27,7 @@ const useKeypress = (key: string, callback: (event: KeyboardEvent) => void) => {
return () => {
document.removeEventListener("keydown", handleKeydown);
};
- }, [key, callback]);
+ }, [key]);
};
export default useKeypress;