Skip to content

bug(platform): a task discussion drops an open comment edit when it grows past 100 rows #4431

Closed

Description

@yannickmonney

Summary

dac9bf2fcf ("fix(platform): keep large collections responsive", pushed directly to main on 2026-10-06) changes a task's discussion (comments and activity). Once it holds more than 100 rows, it renders only the rows near the view, the window. Rows with an open editor, delete dialog, actor preview or run dialog are meant to stay in the DOM, pinned, even when scrolled out of view.

That pin only works once the window is on. At 100 rows or fewer, the pin is a no-op. So when the count crosses 100 while such a row is out of view, the row is dropped in the same render that turns the window on. Its unsaved edit is lost.

Source and environment

  • Commit: main at dac9bf2fcf46b1fd3936859eb94ecb1ce583bd22. The files below are unchanged at 9bd1e2015d.
  • How it was found: by reading the code. Nothing was run in a browser.

How it happens

  1. The threshold: useTaskLogWindow passes threshold: 100 (services/platform/app/features/tasks/hooks/use-task-log-window.tsx:144). useVirtualList switches at count > threshold with no hysteresis (packages/ui/src/hooks/use-virtual-list.ts:117).
  2. The no-op pin: until the list is windowed, rows get a no-op activity setter: setRowActive: window.virtualized ? setRowActive : NOOP_SET_ROW_ACTIVE (use-task-log-window.tsx:179, explained at :173-176).
  3. The edit lives in the row: a comment's edit state is row state that registers through that setter: const [editing, setEditing] = useState(false); useTaskLogRowActivity(editing); (task-comments.tsx:129-130). Below 100 rows the registration does nothing, so activeRows stays empty and pinnedIndices is [] (use-task-log-window.tsx:118-125).
  4. The crossing render: in the first render with more than 100 rows, the window is computed with no pins. An edited row outside the visible range is not rendered, so its editor unmounts with the draft. The real setter can't pin it afterwards, because the row is already gone.

Reproduction (deterministic, from the code)

  1. Open a task in the modal with 90 loaded comments (pages hold 30, per PERF-P13). Click Edit on a comment and type a change, without saving.
  2. Scroll that comment out of view. The editor loses focus; focus is now on Show earlier comments, say.
  3. Load the next page (120 rows), or let live comments push the count past 100.
  4. Observed (by reading): the edited comment is outside the window, its row unmounts, and the draft and edit mode are gone. The same applies to an open delete confirmation (Cancel then sends focus to <body>), an actor preview, or a run-outcome dialog anchored to an out-of-view row.

Expected: what task-comments.tsx:223 states, "the editor stays mounted while editing, including when scrolled offscreen", should hold across the threshold too.

Coverage

  • task-log-window.browser.test.tsx:329 (edit draft survives scrolling) starts with 2,500 comments, so the list is already windowed.
  • The 50-row cases never window.
  • No test crosses 100 rows while a row is active.

Possible directions

These are suggestions only:

  • Register activity in both modes. The comment at :173-176 gives this up to save one list reconciliation.
  • Or add hysteresis, as the board's lanes do: windowed above 40, back to every card only below 30 (windowed-task-rows.tsx).

Related

#4414 is the same class of bug in other lists: Home's stream and PROJECTS list remount every row when they cross 60.

Limits

Read-only post-merge review. No browser, test, build or benchmark was run.

Found in the TALE-965 post-merge review of 890de625..dac9bf2fcf (main after v0.5.74, slice 1).

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

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions