Skip to content

Sub-work items list flashes then disappears in the work item detail pane #9863

Closed as not planned

Description

@richardbraden

Bug: Sub-work items list flashes then disappears in the work item detail pane

Repro:

  1. Open a work item that has existing sub-work items.
  2. The "Sub-work items" section header renders correctly (e.g. "4/7 Done"), and the list of sub-items briefly flashes into view.
  3. The list then disappears immediately, and the section is left empty.
  4. Collapsing and re-expanding the "Sub-work items" section does not bring the list back — it stays empty for the rest of that page view.

The header's progress count (4/7 Done) stays correct throughout; only the list body is affected.

Root cause

  • apps/web/app/entry.client.tsx wraps the app in <StrictMode>, which double-invokes mount effects in dev.
  • SubIssuesCollapsibleContent's mount effect (apps/web/core/components/issues/issue-detail-widgets/sub-issues/content.tsx) calls handleFetchSubIssues(), which is guarded by a snapshot check on issue_visibility taken before the await. Under the double-invoke, both invocations pass that guard concurrently, and both eventually call setSubIssueHelpers(..., "issue_visibility", parentIssueId) once their own fetch resolves.
  • setSubIssueHelpers (apps/web/core/store/issue/issue-details/sub_issues.store.ts) implements this as a toggle (add if absent, remove if present) — correct for its other call sites (bracketed loaders, and a genuine click-to-expand toggle for nested sub-issue rows), but wrong for this one, which is meant to be a one-way "now loaded" marker.
    • 1st completion: flag is empty → added → list renders (the "flash").
    • 2nd completion: flag already contains the value → removed → list unmounts (the "disappear").
  • Since Collapsible's panel is Disclosure.Panel static (packages/ui/src/collapsible/collapsible.tsx), the content component is always mounted (just CSS-hidden when collapsed), so expanding/collapsing never re-runs the mount effect — the flag stays stuck off for the rest of the page view.
  • The header stays correct because it reads a separate, idempotently-overwritten id array (subIssues[parentIssueId]), not this toggled flag.

This is a real bug independent of StrictMode (any duplicate invocation of the effect would trigger the same flip), but StrictMode-in-dev makes it reproduce on effectively every load.

Fix

Give setSubIssueHelpers an idempotent "add" mode (default remains "toggle", so all 12 other call sites — bracketed loaders in helper.ts/parent-select-root.tsx, and the nested-row expand toggle in issues-list/list-item.tsx — are unaffected), and use it for the one-way "loaded" marker in content.tsx.

Verified with tsc --noEmit and oxlint --deny-warnings (both clean) and manually in the browser — the list now stays populated across repeated reloads, and the nested-row expand/collapse toggle still works.

Branch with both commits: https://github.com/richardbraden/plane/tree/fix/sub-work-items-flash

diff --git a/apps/web/core/components/issues/issue-detail-widgets/sub-issues/content.tsx b/apps/web/core/components/issues/issue-detail-widgets/sub-issues/content.tsx
index 0dbf8c85ab..2eed1b92fa 100644
--- a/apps/web/core/components/issues/issue-detail-widgets/sub-issues/content.tsx
+++ b/apps/web/core/components/issues/issue-detail-widgets/sub-issues/content.tsx
@@ -89,7 +89,7 @@ export const SubIssuesCollapsibleContent = observer(function SubIssuesCollapsibl
       try {
         setSubIssueHelpers(`${parentIssueId}_root`, "preview_loader", parentIssueId);
         await subIssueOperations.fetchSubIssues(workspaceSlug, projectId, parentIssueId);
-        setSubIssueHelpers(`${parentIssueId}_root`, "issue_visibility", parentIssueId);
+        setSubIssueHelpers(`${parentIssueId}_root`, "issue_visibility", parentIssueId, "add");
       } catch (error) {
         console.error("Error fetching sub-work items:", error);
       } finally {
diff --git a/apps/web/core/store/issue/issue-details/sub_issues.store.ts b/apps/web/core/store/issue/issue-details/sub_issues.store.ts
index 74ffad7aae..355b12539f 100644
--- a/apps/web/core/store/issue/issue-details/sub_issues.store.ts
+++ b/apps/web/core/store/issue/issue-details/sub_issues.store.ts
@@ -60,7 +60,12 @@ export interface IIssueSubIssuesStore extends IIssueSubIssuesStoreActions {
   subIssueHelpersByIssueId: (issueId: string) => TSubIssueHelpers;
   // actions
   fetchOtherProjectProperties: (workspaceSlug: string, projectIds: string[]) => Promise<void>;
-  setSubIssueHelpers: (parentIssueId: string, key: TSubIssueHelpersKeys, value: string) => void;
+  setSubIssueHelpers: (
+    parentIssueId: string,
+    key: TSubIssueHelpersKeys,
+    value: string,
+    mode?: "toggle" | "add"
+  ) => void;
 }
 
 export class IssueSubIssuesStore implements IIssueSubIssuesStore {
@@ -116,11 +121,16 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
   });
 
   // actions
-  setSubIssueHelpers = (parentIssueId: string, key: TSubIssueHelpersKeys, value: string) => {
+  setSubIssueHelpers = (
+    parentIssueId: string,
+    key: TSubIssueHelpersKeys,
+    value: string,
+    mode: "toggle" | "add" = "toggle"
+  ) => {
     if (!parentIssueId || !key || !value) return;
 
     update(this.subIssueHelpers, [parentIssueId, key], (_subIssueHelpers: string[] = []) => {
-      if (_subIssueHelpers.includes(value)) return pull(_subIssueHelpers, value);
+      if (_subIssueHelpers.includes(value)) return mode === "add" ? _subIssueHelpers : pull(_subIssueHelpers, value);
       return concat(_subIssueHelpers, value);
     });
   };
@@ -186,10 +196,10 @@ export class IssueSubIssuesStore implements IIssueSubIssuesStore {
         });
       });
 
-      const issueIds = subIssues.map((issue) => issue.id);
+      const newSubIssueIds = subIssues.map((issue) => issue.id);
       update(this.subIssues, [parentIssueId], (issues) => {
-        if (!issues) return issueIds;
-        return concat(issues, issueIds);
+        if (!issues) return newSubIssueIds;
+        return concat(issues, newSubIssueIds);
       });
     });

Activity

  1. richardbraden commented on Sep 19, 2026

    @richardbraden
    Author

    This was already fixed upstream in b494044 (fix(web): keep sub-work items visible after local fetch, #9804), merged the day before I opened this — same root cause (setSubIssueHelpers toggles membership + React Strict Mode's double mount effect), fixed via a different, self-contained approach in content.tsx.

    My local base was 62 commits behind preview when I diagnosed this, so I hadn't seen the fix land yet. Verified after rebasing onto current upstream/preview that the list no longer flashes/disappears. Closing as already resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions