Skip to content

Bug: a 2,000-task board blocks the tab for 16–26 s when it is searched, left or opened #4062

Closed

Description

@yannickmonney

What happened?

On a project board with 2,000 tasks, the board's cap, the tab blocks for 16–26 s when the board is searched, left, opened or loaded. Each time the cost is one long main-thread task, and the page takes no input until it ends. At 50 tasks the same flows take 0.2–1 s.

The measurements are medians on a local production build, with min–max in brackets. "Visible" is the frame that shows the result. Search times start at the last key and include the 300 ms debounce.

2,000-task board main 05543548e (2 Oct) main d6dd53ae0 (1 Oct) Longest task (2 Oct)
Search zebra, narrowing 2,000 cards to 20 20.0 s (15.6–22.0), n=6 24.2 s (20.9–27.3), n=5 19.7 s
…the first search after the board loaded — 48.1 s, n=1 —
Leave the board (click General) 16.7 s (15.8–18.4), n=4 26.8 s (19.2–38.9), n=6 16.7 s
Clear the search (back to 2,000 cards) 18.1 s (17.5–18.5), n=6 20.2 s (19.3–22.9), n=5 16.2 s
Open the board in-app (click the project's Tasks tab) 22.0 s (21.7–22.8), n=4 26.4 s (23.8–32.3), n=6 21.9 s
Cold load of the board URL 25.6 s (24.6–26.9), n=4 25.5 s (24.3–28.2), n=5 14.4 s

The 1 Oct campaign also measured smaller boards (main d6dd53ae0, n=10 each):

Board Open in-app Leave Search Clear Cold load JS heap after load Elements react-query observers
50 tasks 0.87 s 0.23 s 0.37 s 0.82 s 4.1 s 83 MB 8,276 2,525
350 tasks 3.9 s 0.73 s 0.81 s 3.4 s 8.3 s 236 MB 15,583 16,625
2,000 tasks 26.4 s 26.8 s 24.2 s 20.2 s 25.5 s 1,059 MB 54,992 94,175

Memory is part of it too. A reload of the 2,000-task board kept the old document's heap next to the new one, at 1.76 GB of JS heap. A few search narrow/clear cycles did the same. Twice the measurement renderer passed 3.5 GiB of the sandbox's 4 GiB, and the harness's guard killed it. Later runs collect garbage between samples.

There are two causes.

1. Unmounting cards costs time quadratic in the number of cards (search, leave, filter).

  • react-query's Query.removeObserver scans its observer array and copies it, through includes and then filter (@tanstack/query-core 5.97.0, build/modern/query.js:148–150). Removing one observer is O(observers).
  • Every card holds about 47 observers. 30 of them sit on two queries that every card shares: ['backend','me','account','current-user'] and ['auth','session'].
  • They come from useBackendQuery (services/platform/app/hooks/use-backend-query.ts), which calls useSessionUser(), two useQuerys, on every read. An adapted read never uses that answer: isAuthenticated only gates the branch for a name with no adapter row, and missing-row.ts says every shipped read has one.
  • At 2,000 cards, those two queries hold 30,055 and 30,054 observers. Narrowing to 20 cards removes about 59,000 of them, each from an array of up to 30,000.
  • In a CPU profile of that narrow, removeObserver and its filter callback take 32.5 s of 38.1 s busy (85%). React's own unmount takes 2.3 s.

2. Mounting a card costs about 10–13 ms of main thread on this host (open, clear, load).

Nothing is windowed: all 2,000 cards render, though about 40 fit a 1440×900 window. The self time of a cold 2,000-task load breaks down as:

Category Share of self time
i18n 19.7%
React render/commit 18.9%
GC 17%
react-query 10.4%
@tale/ui 5.5%
Radix 4.5%
App data hooks 3.8%
dayjs timezone 1.4%

What a card mounts:

  • Two actor directories. TaskCard calls useActorDirectory, and AssigneePicker calls useAssignableActors. Each brings the member list, member context, project agents and automation listings, and builds its maps for that card.
  • Three automation listings, counting TaskAutomationBadge.
  • About 20 useTranslation instances. react-i18next 17.0.2 copies the i18n instance's own property descriptors into a wrapper for every hook instance (useTranslation.js:105, 1.9 s of self time in the load). i18next 26.0.4 re-derives the fallback codes and the language hierarchy on every t() call.
  • The assignee picker's full SearchableSelect options, built whether or not the picker opens. AssigneePicker alone is 5.9 s of 32.6 s busy in that profile, inclusive.

The board's read is not the bottleneck. It answers in about 0.26 s with 3.35 MB of JSON, every task's full description included, though no card shows one.

An experiment, not a proposed patch. I dropped the useSessionUser() call from useBackendQuery:

-  const { isAuthenticated } = useSessionUser();
-  // `requireAuth` is our own gate, not a react-query option — peel it off.
-  const { requireAuth = true, ...queryOpts } = options ?? {};
+  const { requireAuth: _requireAuth, ...queryOpts } = options ?? {};
 …
-    enabled =
-      !skipped &&
-      (requireAuth ? isAuthenticated : true) &&
-      (base.enabled ?? true);
+    enabled = !skipped && (base.enabled ?? true);

I measured it ABBA (main, patch, patch, main) against the same main, on the same stack, fixture and harness. The table gives medians with min–max:

2,000-task board 2 Oct: main 05543548e 2 Oct: + experiment 1 Oct: main d6dd53ae0 1 Oct: + experiment
Search narrow 20.0 s (15.6–22.0) 2.45 s (2.31–2.72) 24.2 s (20.9–27.3) 2.59 s (2.37–2.92)
Leave 16.7 s (15.8–18.4) 2.43 s (2.04–2.73) 26.8 s (19.2–38.9) 2.63 s (2.13–2.96)
Clear search 18.1 s (17.5–18.5) 16.5 s (16.0–18.2) 20.2 s (19.3–22.9) 16.8 s (16.4–17.9)
Open in-app 22.0 s (21.7–22.8) 16.7 s (16.5–17.0) 26.4 s (23.8–32.3) 18.8 s (17.9–21.7)
Cold load 25.6 s (24.6–26.9) 23.1 s (22.0–24.1) — —
JS heap after cold load 1,060 MB 847 MB — —
react-query observers 94,175 34,091 94,175 34,091

Sample counts: on 2 Oct, n=6 for search and n=4 for the rest. On 1 Oct, n=6 except main's search (n=5).

At 50 tasks, on 2 Oct (n=8), the experiment did not slow anything: in-app open went from 1.01 s to 0.94 s, and leave from 0.25 s to 0.21 s.

So the experiment fixes cause 1 alone. Open, clear and load stay at 16–23 s, because they come from cause 2.

The experiment also drops the auth gate from the missing-row branch, which use-backend-query.test.ts covers in "gates on auth by default" and "requireAuth:false runs even when unauthenticated". A real fix keeps that gate without one session subscription per read, or retires it on purpose, tests included. As built, the experiment adds one tiny preloaded chunk, use-session-user: Cold-load JS goes from 44 modules and 2,059 KB gzip to 45 modules and 2,060 KB.

Steps to reproduce

  1. Build and serve production: bun run build in services/platform, then vite preview, proxying to the backend (ROLE=api, NODE_ENV=production) on a fresh Postgres.
  2. Seed one project with 2,000 tasks. The replay kit's seed-tasks.ts does it through the board's own createTask, addTaskComment and addTaskDependency, with a fixed seed. It gives a status mix and priorities p0–p3, 0–3 labels, five member assignees, descriptions on 70% of tasks, due dates on 30%, ~6% subtasks, comments and blockers. "zebra" is in 20 titles.
  3. Open the project's General tab and click Tasks. The board blocks for ~22 s.
  4. Type zebra in Search tasks. ~20 s pass before the 20 matches show.
  5. Clear the search, ~18 s, or click General, ~17 s.

The replay kit is attached to the TALE-361 occurrence receipt (task box): stack scripts, the fixture seeder, the Playwright harness, raw JSONL samples, CPU profiles with a sourcemap-resolving analyzer, per-second host monitors and the experiment's diff.

Expected behavior

The board stays usable at its own cap. Acceptance budget, on this harness and host class (n ≥ 5, medians, the visible frame):

  • Search narrowing and leaving the 2,000-task board: ≤ 3 s each, from the last key or the click. The experiment alone reaches ~2.5 s.
  • Clearing the search, opening the board in-app, and a cold load at 2,000 tasks: ≤ 10 s each, with JS heap after load ≤ 600 MB. Today they take 18–26 s and the heap is ~1.06 GB. This needs cause 2 work, not only the experiment.
  • No regression at 50 tasks: in-app open ≤ 1.1 s median (today 1.01 s), and TASK-P1 holds.
  • A guard in the tests: the observer count on the shared session queries stays flat as the board grows, for example a tasks-workspace render test with N cards that reads getObserversCount().
  • Kept intact: drag and drop, keyboard reach and screen-reader announcements of every card, the inline pickers, and the board's filters and counts.

Directions, largest first. These are candidates, not decisions:

  1. Stop subscribing every adapted read to the session probe. That is 64% of the board's observers, and cause 1's multiplier.
  2. Read the org-wide data once per board: actor directory, automation listings, member context, project, accessible users, standard agent. Hand it to the cards through the existing TaskBoardProvider, and build each picker's options only when it opens.
  3. Make a card's i18n cheaper: one t per namespace from context, or labels computed once per board.
  4. Window the columns. This is a design decision: dnd-kit, keyboard reach and screen-reader counts, and find-in-page all depend on it.
  5. Upstream: react-query keeps observers in an array, so each removal is O(n). A Set would make it O(1).

This is related to #3974, the dialog open and close on the same board, but is not a duplicate. #3974's item 2, the observer bookkeeping with 26,058 observers on current-user, is the same multiplier, so cause 1's fix should shrink its close too. This issue's flows are load, search, filter and leave. Recheck #3974's numbers after a fix.

Affected service

Platform (web app)

Version or commit

05543548eb486321e0cd6bdb82ccf98260cf5295 (2 Oct) and d6dd53ae0b9bd154f85d2f325ffadc3b56b46883 (1 Oct). Neither commit changes use-backend-query.ts, use-session-user.ts, the tasks feature or packages/ui/src/i18n relative to the other.

Browser and OS

  • Browser: Chromium 141.0.7390.37, headless, 1440×900, DPR 1, service workers blocked; Playwright-core 1.58.2; Node 24.21.0.
  • Host: Linux sandbox with 4 vCPU (DO-Premium-AMD), capped by its cgroup at 2 CPUs and 4 GiB.
  • Other tenants: a mean of 0.33–0.70 CPU per 2 Oct block, at most 1.12 CPU at p90 of 1 s samples, with steal ≤ 0.03 CPU.
  • Caveat: the large flows run into the cgroup's own CPU throttle. Absolute times here are a constrained VM's, not a laptop's; the A/B ratios carry over.

Relevant log output

The CPU profile of the narrow, self time, resolved through the build's sourcemaps:

27028 ms  (anonymous) @ nm:@tanstack/query-core/build/modern/query.js:150   ← observers.filter(x => x !== observer)
 5511 ms  removeObserver @ nm:@tanstack/query-core/build/modern/query.js:148
 1804 ms  react-dom commit
 1734 ms  (garbage collector)

Activity

  1. added
    perf
    bug
    service: platform
    on Oct 2, 2026
  2. yannickmonney commented on Oct 2, 2026

    @yannickmonney
    ContributorAuthor

    #4067 rechecked against this issue's original workload. #4067 is merged as 2a169f4c7. The recheck ran in the TALE-361 performance occurrence of 2026-10-02 11:15 Zurich, run 4f013cc1.

    Setup. The kit and fixture are the ones above:

    • production builds served by vite preview;
    • the backend with ROLE=api, on a scratch Postgres;
    • the deterministic 50/350/2,000-task seed;
    • Chromium 141, headless, 1440×900.

    ABBA blocks compare 9b91fb64a, the merge's first parent, with 2a169f4c7, one heavy operation at a time. Medians, with min–max:

    2,000-task board 9b91fb64a 2a169f4c7 (#4067) Budget
    Search narrow (n=6) 26.7 s (19.9–31.6) 3.07 s (2.81–3.71) ≤ 3 s
    Leave (n=4) 21.1 s (18.9–22.5) 3.11 s (2.23–3.61) ≤ 3 s
    Clear search (n=6) 22.2 s (21.0–22.7) 20.0 s (18.2–20.9) ≤ 10 s
    Open in-app (n=4) 25.8 s (25.6–27.3) 20.1 s (19.7–23.3) ≤ 10 s
    Cold load (n=4) 35.0 s (32.5–38.1) 33.5 s (28.3–36.1) ≤ 10 s
    JS heap after cold load 1,081 MB 896 MB ≤ 600 MB
    react-query observers 94,175 34,084 —
    Task dialog open / close (#3974, n=6) 3.15 s / 2.54 s 2.83 s / 1.73 s TASK-P4: < 1 s

    On the 50-task board nothing regressed:

    50-task board 9b91fb64a 2a169f4c7 n
    In-app open (budget ≤ 1.1 s) 1.24 s 1.08 s 8
    Leave 0.33 s 0.25 s 8
    Dialog open 1.01 s 1.00 s 10
    Dialog close 0.62 s 0.57 s 10

    The dialog rows come from a second ABBA run, under heavier load from other tenants.

    What the numbers say

    • Cause 1 is fixed. Observers on the shared session queries no longer grow with the number of cards. Search narrow and leave fall 7–9×. The 34,084 observers left are the per-card organization reads of cause 2.
    • The ≤ 3 s budget is borderline on this host, not clearly failed. The medians are 3.07 s and 3.11 s, close to the PR's own 3.02 s. This host ran slower than at the 03:15 run: main's narrow took 26.7 s today, against 20.0 s then.
    • Cause 2 is untouched, by design. Open, clear and cold load stay at 20–34 s, and the heap at about 0.9 GB. Those budget lines stay open here.
    • Today's cold-load samples are noisy. During one base block, other tenants used a mean of 1.18 CPU (p90 2.84); during the others, about 0.35.

    The evidence is in the TALE-361 task box: receipt 2026-10-02T1115, and a bundle with raw JSONL samples and per-second host monitors.

  3. yannickmonney commented on Oct 5, 2026

    @yannickmonney
    ContributorAuthor

    TALE-361 recheck of main's 5 Oct perf batch against this issue's original workload. Every timed budget item is met on main, and the keyboard check passes.

    How it was run

    • A/B: ABBA blocks (base, main, main, base) of base e9c6a8fb3, the commit before the batch, against main 315f216b3.
      • The range holds 8 perf commits pushed straight to main, 7cdefb913, c5894663e (windowed board lanes), 9981cbf3a, f18ecf0b1, 437fe9fa4, 6978c8e60, d44a770a9 and 315f216b3, plus fix(platform): freeze the compose draft while it sends #4362's merge 3ba3b8679.
      • It changes no backend code, so one backend served both arms.
    • Stack: production builds served by vite preview, the backend with ROLE=api, my own Postgres 16.14, and no egress.
    • Fixture: this issue's 2 Oct generator, with boards of 50 and 2,000 tasks ("zebra" in 20 titles).
    • Browser: Chromium 141, headless, 1440×900.
    • "Visible", made arm-neutral: the windowed board never mounts all 2,000 cards, so a full board counts as visible when every lane header's count sums to the total and every non-empty lane has a card mounted. On the unwindowed base that is the same frame as "all cards". Narrow and leave keep their exact card counts, and the timing points are the original harness's.
    • Host contention: other tenants averaged 0.36–0.64 CPU over the sample windows (p90 ≤ 1.09), and steal stayed ≤ 0.02. One gate timed out before the first base block's two cold loads (load1 6.5).
    • Statistics: medians with min–max; n=6 per arm, n=4 for cold loads.
    2,000-task board 2 Oct (this issue) Base e9c6a8fb3 Main 315f216b3 Budget Met?
    Search narrow, from the last key 20.0 s 3,188 ms (2,941–3,888) 496 ms (476–523) ≤ 3 s ✅
    Leave (click General) 16.7 s 3,082 ms (2,856–5,391) 224 ms (199–253) ≤ 3 s ✅
    Clear the search 18.1 s 20,312 ms (18,273–20,844) 886 ms (833–932) ≤ 10 s ✅
    Open in-app (click Tasks) 22.0 s 21,712 ms (19,200–23,372) 802 ms (743–900) ≤ 10 s ✅
    Cold load 25.6 s 27,670 ms (25,504–30,190) 4,498 ms (4,123–4,971) ≤ 10 s ✅
    JS heap after the cold load 1,060 MB 961 MB 101 MB ≤ 600 MB ✅
    …its longest task 14.4 s 15.4 s 0.56 s —
    Elements / react-query observers 54,992 / 94,175 56,338 / 34,084 9,840 / 1,274 —
    50 tasks: open in-app 1.01 s 1,041 ms (955–1,111) 710 ms (637–747) ≤ 1.1 s ✅

    The per-block medians repeat within each arm. For example, the in-app open was 22.4 s and 20.2 s in the two base blocks, and 0.82 s and 0.76 s in the two main blocks.

    The rest of the budget

    • Test guard ✅: services/platform/app/hooks/session-probe-observers.test.tsx (test(platform): pin session-probe gate branches and batch notifications #4191) pins the shared session-probe observers flat. It is in both arms.
    • Counts and search ✅: the lane headers read 2,000 in every sample, and search narrows to exactly the 20 matches.
    • Keyboard reach ✅:
      • From the first card of a 596-card lane, 240 Tabs walked its window rows 0 → 80 in order, with no gap or repeat.
      • Every focused card was in view, and at most 18 cards were mounted.
      • The slowest Tab painted in 104 ms.
    • A trade-off the batch documents (not-a-finding.md): find in page and a screen reader's browse mode reach a long lane's tasks only once they are near the view.
    • Not measured here: drag and drop, the inline pickers and screen-reader announcements. The batch adds browser tests for them and the manual box TASK-P5.

    Notes

    The raw samples and the kit are in TALE-361's tale-361-perf-evidence-bundle.tar.gz, under occ-20261005T1915/: bench4.mjs, ab-4062.sh, probe-keyboard.mjs and the summaries.

  4. added
    agent-ready
    on Oct 29, 2026
  5. 4 remaining items

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

    agent-readybugperfservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions