[PR #7218] [MERGED] fix(chat): keep a large message trash responsive #7629

Closed
opened 2026-10-24 04:06:01 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7218
Author: @SpicyMarinara
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/large-trash-responsive-7210


📝 Commits (5)

  • 80662e6 fix(chat): keep a large message trash responsive
  • 252709f Merge origin/staging into fix/large-trash-responsive-7210
  • 63ed1eb fix(chat): fill a large trash 200 rows at a time
  • 6723f57 fix(chat): restart the trash's progressive fill when the chat changes (#7210)
  • f5d5a67 Merge remote-tracking branch 'origin/staging' into fix/large-trash-responsive-7210

📊 Changes

4 files changed (+384 additions, -70 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
➕ e2e/message-trash-responsive.e2e.ts (+196 -0)
📝 packages/client/src/components/chat/ChatMessageMarksPanels.tsx (+185 -69)
📝 packages/client/src/components/chat/ChatMessageSearch.tsx (+2 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7210

Why this change

  • A chat's message trash with thousands of entries froze the page. Every row rendered at once (about 15 s on CI WebKit for the 5,001-entry message-trash-batching fixture), and every row re-rendered and restyled when a restore or delete started or finished, which took several more seconds. Phones are hit hardest.
  • A restore failure toast could then disappear almost as soon as it painted, because its 6 s timer ran while the page was blocked.
  • The existing batching spec asserts all 5,001 rows' Restore buttons exist, so the fix keeps every row in the DOM: no virtualization and no paging.

What changed

  • ChatMessageMarksPanels.tsx (only product file):
    • The trash renders in memoised batches of 200 rows (100 in the first commit; see Batch size below). The first batch renders right away, then one more each time the browser is idle (requestIdleCallback, or a 16 ms timer in WebKit). Every row ends up in the DOM. If the list shrinks, the count shrinks with it, so a list that grows large again also fills in batch by batch.
    • Rows and batches are memo components with stable callbacks. A busy change, a delete confirmation on one row, or a refetch that keeps the same entries no longer re-renders the other rows.
    • While a restore or delete runs, the list gets aria-busy and a dimmed cover (bg-[var(--background)]/50, cursor-progress) instead of a disabled attribute on each of the 10,002 row buttons. Restyling those buttons, or a disabled fieldset around them, took about 2–3 s in WebKit even after React stopped re-rendering the rows. Row actions are ignored while busy, including from the keyboard. Restore all and Empty trash are still natively disabled.
    • Each row draws its own top border instead of the list using divide-y, so appending a batch never restyles the rows above it. It looks the same: the first row's border is the line under the header.
    • Restore failure and partial-restore warnings stay up for 15 s instead of 6 s. I chose this over "until dismissed" because a toast that never times out covers the phone Chat Settings sheet's header until it is closed.
  • e2e/message-trash-responsive.e2e.ts (new): with 1,001 mocked entries, it checks that:
    • no DOM update adds more than one batch of rows, and every row arrives;
    • a held Restore all sets aria-busy and keeps the restore request count at 1 when a row's Restore is pressed with Enter;
    • the busy cycle causes no DOM change inside the rows and no row render. A React DevTools hook counts row renders, and the spec first checks that the counter does see renders.
    • Negative controls: the spec fails on the old component (1,001 rows added in one update), with memo removed (8,503 row renders vs 6,501), and without the busy guard (2 restore requests).
  • CHANGELOG.md: an [Unreleased] entry.

Measurements

The table below is from the first commit, with batches of 100. Numbers for the final batches of 200 are under Batch size.

These come from a temporary measuring spec (not committed). It used the same 5,001-entry mock as message-trash-batching, on the Vite dev build. Baseline and fix runs alternated on a busy machine (load average 7–26 from other jobs), so read the numbers as relative. "Max block" is the longest gap in a 10 ms page heartbeat.

Phase Browser Before: max block / time to result After: max block / time to result
Open Trash Chromium 1.5–1.8 s / first rows after 1.9–2.3 s 0.25–0.27 s / first rows after 0.17–0.34 s (all rows by 3.1–3.9 s)
Open Trash WebKit (iPhone 15 Pro) 3.2 s / 3.4 s 0.17 s / 0.25–0.32 s (all rows by 5.4–5.7 s)
Click Restore all → disabled Chromium 0.90–0.98 s / 1.7–1.8 s 0.42–0.51 s / 0.84–1.0 s
Click Restore all → disabled WebKit 2.1 s / 2.9 s 0.06–0.08 s / 0.38–0.39 s
Response → enabled again Chromium 0.93 s / 1.35 s 0.08–0.11 s / 0.37–0.51 s
Response → enabled again WebKit 1.9–2.4 s / 2.2–2.7 s 0.06–0.08 s / 0.25–0.31 s
Open Trash, Chromium 4× CPU throttle Chromium 6.0 s / 6.8 s 1.1 s / 0.66 s
Click Restore all, 4× throttle Chromium 3.7 s / 7.0 s 1.45 s / 3.1 s
Response, 4× throttle Chromium 3.8 s / 5.6 s 0.54 s / 1.75 s
Row attribute changes when busy starts both 10,002 0
  • Existing spec durations on this machine:
    • message-trash-batching, desktop-chromium: 8.5 s / 9.2 s before, 3.5 s / 6.1 s after.
    • message-trash-batching, mobile-webkit: 12.1 s / 15.6 s before, 4.7 s / 11.8 s after. The conflicts-only test now waits for the progressive fill before its 5,001-row count.
  • The Chromium time left on the Restore all click (about 0.3–0.5 s, about 1.1 s at 4× throttle) is not trash code. In a Chromium trace, the focus change when the clicked button becomes disabled invalidates style for every descendant of the Chat Settings window (allDescendantsMightBeInvalid). That forces a whole-document style recalculation, about 85k elements with this list open. It happens for any focus change in that window and in baseline too. It's a likely follow-up; see the note below.

Batch size: 100 → 200 (verification follow-up)

With batches of 100, the existing conflicts-only message-trash-batching test (unchanged) clicks Restore all while the list is still filling in. It then waits for all 5,001 rows with toHaveCount(5001) and the default 10 s timeout. CI runs this spec about 3× slower than a local machine: on the 2026-10-07 nightly matrix it took 30.1 s on desktop-chromium and 51.6 s on mobile-webkit, against 9.2 s and 15.6 s locally. In a temporary copy of that test, time spent in the final toHaveCount(5001) wait:

Condition Batches of 100 Batches of 200
desktop-chromium, CDP CPU throttle 3× 8.7–9.4 s 6.2–7.2 s
desktop-chromium, CDP CPU throttle 4× ~15 s (the real 10 s assertion fails: 3,600/5,001 rows at 5×) 9.4–10 s
mobile-webkit, 6 parallel copies (local load) 6.3–7.8 s 3.9–5.0 s
staging (all rows at once), 5× rows already present; the open alone took 25.6 s

A Chromium trace shows that each batch restyles only its own ~1.7k new elements and lays out only the ~2.4k new objects, so the cost is per row, not per list. Wrapping each batch in a div (plain, contain: content or contain: layout style) made WebKit's fill slower: 6.6–9.1 s against 5.1 s. Replacing requestIdleCallback with a 0 ms timer did not speed up Chromium under throttle. Fewer, larger batches were the one simple lever. I kept the 16 ms WebKit timer because a timer that is always ready could delay WebKit paints, and a heartbeat can't show that. The new spec's per-update limit and the CHANGELOG now say 200.

Final numbers, 5,001 entries, Vite dev build, load average 3–5. "Max block" is the longest gap in a 10 ms heartbeat; p90 is over gaps above 50 ms.

Phase Browser staging Batches of 100 Batches of 200 (final)
Open: first rows Chromium 1.75 s 0.15–0.21 s 0.20–0.25 s
Open: all rows Chromium 1.97 s 2.5–2.6 s 2.2 s
Open: max block (p90) Chromium 1.48 s 0.24 s (0.085 s) 0.23 s (0.125 s)
Open: first rows WebKit 3.33 s 0.25 s 0.37 s
Open: all rows WebKit 3.49 s 5.8–5.9 s 4.45–4.55 s
Open: max block (p90) WebKit 3.0–3.2 s 0.16 s (0.095 s) 0.155–0.16 s (0.13–0.14 s)
Restore all click: max block Chromium / WebKit 0.88 s / 2.1 s 0.36–0.38 s / 0.06–0.09 s 0.35–0.38 s / 0.08–0.13 s
Response: max block Chromium / WebKit 0.91 s / 2.4 s 0.07–0.08 s / 0.07–0.08 s 0.07 s / 0.07–0.14 s

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Agent-run checks:

  • pnpm check passed, including localization, format, lint, e2e types and build.
  • pnpm localization:check passed (no new strings).
  • These specs passed on desktop-chromium and mobile-webkit: message-trash-batching, message-marks-trash and the new message-trash-responsive. The existing specs are unchanged.
  • message-trash-responsive also passed with --repeat-each=3 on desktop-chromium, mobile-chromium and mobile-webkit.

Verification pass (after merging origin/staging, with batches of 200; head 63ed1ebbe):

  • pnpm check passed (exit 0), including localization:check.
  • These specs passed on desktop-chromium and mobile-webkit (16/16): message-trash-responsive, message-trash-batching, message-marks-trash, message-marks-colors and chat-settings-tools.
  • message-trash-responsive and message-trash-batching passed with --repeat-each=3 --workers=3 on all three projects (27/27).
  • --repeat-each=3 --workers=4 over the three trash specs on desktop-chromium and mobile-webkit: 29/30.
    • The one failure is message-marks-trash roleplay on mobile-webkit: the fixture delete returned trashed: false.
    • The same command fails the same way on staging's component, so it predates this PR. That spec turns the global messageTrash feature on (off by default) and restores it in finally, so parallel repeats on one server switch it off under each other.
  • Negative control: on staging's component, the new spec fails on both engines (1,001 rows added in one update; limit 200).
  • Temporary probes (deleted), on both engines:
    • Restoring a row before the last batch renders keeps every other row exactly once, in order.
    • Delete forever confirmation moves between rows in different batches, and the second click deletes only that row.
    • Empty trash pressed mid-fill sends { all: true } and shows the empty state.
    • Restore all pressed mid-fill sends every ID (2,001), and the list shrinks to the 50 conflicts.
    • When the list grows again, it refills in batches.
    • Switching to Search mid-fill and searching works, with no page errors.
    • The restore error toast is still visible after 8 s and its close button dismisses it.
    • The busy cover follows --background in light and dark themes.
    • In desktop Chromium, Tab order through the rows is unchanged. WebKit skips buttons on Tab by default, so it couldn't be checked there.
    • Row and batch render counts: with 1,001 entries, each row renders once and each batch once (StrictMode doubles the calls). The 6,501/8,503 figures above are the memo-removed control: 100×(1+…+10)+1,001 renders during the fill, plus 2×1,001 for the busy cycle.

Manual verification notes

  • Manually verify in a browser: open Chat Settings → Search messages → Trash for a chat with a large trash (several thousand entries; the e2e fixture's mock works). The first entries should appear at once, the rest should fill in while you scroll, and the page should keep responding.
  • Manually verify: press Restore all on a large trash. The entries dim with a busy cursor, Restore all and Empty trash are disabled, and clicking or pressing Enter on a row's Restore or Delete forever does nothing until it finishes.
  • Manually verify: force a partial or failed restore (for example with the network tab blocking /trash/restore). The warning or error toast stays up for about 15 s.
  • Manually verify in light and dark mode, on desktop and a phone-width viewport: the trash header has a single dividing line under it, rows are separated as before, and no line appears under the last row.
  • Manually verify: delete forever on a single row still needs a second click (Confirm delete), and the confirm state moves when you click a different row.
  • Manually verify with a screen reader (VoiceOver or NVDA) during a held Restore all. The list should be reported as busy. Row Restore and Delete forever buttons can still be focused (unlike staging, where they were disabled), but activating one does nothing until the restore finishes.
  • Manually verify on a slow phone or with 4× CPU throttling: with several thousand entries, the list keeps filling in while you scroll, and the page still responds to taps between batches of 200.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Only CHANGELOG.md changed. docs/chats/chat-settings.md describes the Trash tab only in general terms, so no user docs changed.

Possible follow-up, not filed: any focus change inside the Chat Settings window makes Chromium recalculate style for every element in the window (see Measurements). This is probably a Tailwind group-focus-within: / :is(... *) selector. It is independent of the trash, but a large list there makes it visible.

UI evidence (if applicable)

Not attached. The busy state dims the rows behind a cover instead of dimming only the row buttons. The idle look is unchanged.

Local review

I ran the local CodeRabbit CLI (0.7.6) once on the committed branch, and the verification pass ran it once more on the final branch (base b5b46c786). Both runs returned the same single finding, which I did not apply:

  • Add inert to the row container while busy so keyboard users cannot focus or activate rows. Not applied: toggling inert on the list restyles every row. In my measurements, inert plus a dim on the 5,001-row list blocked WebKit for about 3.4 s when a restore started, worse than before this PR, so it would undo the WebKit fix. The verification pass measured it again on the final code: with inert={busy}, WebKit blocked for 2.3–2.4 s on the Restore all click and 1.7 s on the response, against 0.08–0.13 s and 0.07 s without it. Chromium's response block rose from about 75 ms to 375 ms. Keyboard activation is already handled: restoreEntry and deleteEntry return early while busyRef.current is true. The new spec presses Enter on a covered row's Restore while Restore all is pending and checks that only one restore request was sent. The list also exposes aria-busy instead of being hidden from assistive technology.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Performance
    • Message trash lists load up to 200 entries at a time, with additional entries added progressively.
    • Restoring or deleting messages avoids redrawing every entry, helping keep large trash lists responsive.
  • Behavior
    • Trash entries dim while restore or delete operations are in progress.
    • Restore failure and partial-restore warnings remain visible for 15 seconds.
    • Restore actions are unavailable while a restore operation is in progress.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7218 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/large-trash-responsive-7210` --- ### 📝 Commits (5) - [`80662e6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/80662e62b18adf727ff4240a0a11534cb9c6993e) fix(chat): keep a large message trash responsive - [`252709f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/252709fc630de9dca65cb311c39c9f860552fe4a) Merge origin/staging into fix/large-trash-responsive-7210 - [`63ed1eb`](https://github.com/Pasta-Devs/Marinara-Engine/commit/63ed1ebbe2a7517e537be8d7bf5a0877d88ca397) fix(chat): fill a large trash 200 rows at a time - [`6723f57`](https://github.com/Pasta-Devs/Marinara-Engine/commit/6723f5742039fe45c072732e60b710c18ecc9e93) fix(chat): restart the trash's progressive fill when the chat changes (#7210) - [`f5d5a67`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f5d5a675f6880a4cf02bb612c33693a55efc60bc) Merge remote-tracking branch 'origin/staging' into fix/large-trash-responsive-7210 ### 📊 Changes **4 files changed** (+384 additions, -70 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) ➕ `e2e/message-trash-responsive.e2e.ts` (+196 -0) 📝 `packages/client/src/components/chat/ChatMessageMarksPanels.tsx` (+185 -69) 📝 `packages/client/src/components/chat/ChatMessageSearch.tsx` (+2 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. <!-- See CONTRIBUTING.md § Branches. --> ## Linked issue Closes #7210 ## Why this change - A chat's message trash with thousands of entries froze the page. Every row rendered at once (about 15 s on CI WebKit for the 5,001-entry `message-trash-batching` fixture), and every row re-rendered and restyled when a restore or delete started or finished, which took several more seconds. Phones are hit hardest. - A restore failure toast could then disappear almost as soon as it painted, because its 6 s timer ran while the page was blocked. - The existing batching spec asserts all 5,001 rows' **Restore** buttons exist, so the fix keeps every row in the DOM: no virtualization and no paging. ## What changed - `ChatMessageMarksPanels.tsx` (only product file): - The trash renders in memoised batches of 200 rows (100 in the first commit; see **Batch size** below). The first batch renders right away, then one more each time the browser is idle (`requestIdleCallback`, or a 16 ms timer in WebKit). Every row ends up in the DOM. If the list shrinks, the count shrinks with it, so a list that grows large again also fills in batch by batch. - Rows and batches are `memo` components with stable callbacks. A busy change, a delete confirmation on one row, or a refetch that keeps the same entries no longer re-renders the other rows. - While a restore or delete runs, the list gets `aria-busy` and a dimmed cover (`bg-[var(--background)]/50`, `cursor-progress`) instead of a `disabled` attribute on each of the 10,002 row buttons. Restyling those buttons, or a disabled `fieldset` around them, took about 2–3 s in WebKit even after React stopped re-rendering the rows. Row actions are ignored while busy, including from the keyboard. **Restore all** and **Empty trash** are still natively disabled. - Each row draws its own top border instead of the list using `divide-y`, so appending a batch never restyles the rows above it. It looks the same: the first row's border is the line under the header. - Restore failure and partial-restore warnings stay up for 15 s instead of 6 s. I chose this over "until dismissed" because a toast that never times out covers the phone Chat Settings sheet's header until it is closed. - `e2e/message-trash-responsive.e2e.ts` (new): with 1,001 mocked entries, it checks that: - no DOM update adds more than one batch of rows, and every row arrives; - a held **Restore all** sets `aria-busy` and keeps the restore request count at 1 when a row's **Restore** is pressed with Enter; - the busy cycle causes no DOM change inside the rows and no row render. A React DevTools hook counts row renders, and the spec first checks that the counter does see renders. - Negative controls: the spec fails on the old component (1,001 rows added in one update), with `memo` removed (8,503 row renders vs 6,501), and without the busy guard (2 restore requests). - `CHANGELOG.md`: an `[Unreleased]` entry. ### Measurements The table below is from the first commit, with batches of 100. Numbers for the final batches of 200 are under **Batch size**. These come from a temporary measuring spec (not committed). It used the same 5,001-entry mock as `message-trash-batching`, on the Vite dev build. Baseline and fix runs alternated on a busy machine (load average 7–26 from other jobs), so read the numbers as relative. "Max block" is the longest gap in a 10 ms page heartbeat. | Phase | Browser | Before: max block / time to result | After: max block / time to result | | --- | --- | --- | --- | | Open Trash | Chromium | 1.5–1.8 s / first rows after 1.9–2.3 s | 0.25–0.27 s / first rows after 0.17–0.34 s (all rows by 3.1–3.9 s) | | Open Trash | WebKit (iPhone 15 Pro) | 3.2 s / 3.4 s | 0.17 s / 0.25–0.32 s (all rows by 5.4–5.7 s) | | Click **Restore all** → disabled | Chromium | 0.90–0.98 s / 1.7–1.8 s | 0.42–0.51 s / 0.84–1.0 s | | Click **Restore all** → disabled | WebKit | 2.1 s / 2.9 s | 0.06–0.08 s / 0.38–0.39 s | | Response → enabled again | Chromium | 0.93 s / 1.35 s | 0.08–0.11 s / 0.37–0.51 s | | Response → enabled again | WebKit | 1.9–2.4 s / 2.2–2.7 s | 0.06–0.08 s / 0.25–0.31 s | | Open Trash, Chromium 4× CPU throttle | Chromium | 6.0 s / 6.8 s | 1.1 s / 0.66 s | | Click **Restore all**, 4× throttle | Chromium | 3.7 s / 7.0 s | 1.45 s / 3.1 s | | Response, 4× throttle | Chromium | 3.8 s / 5.6 s | 0.54 s / 1.75 s | | Row attribute changes when busy starts | both | 10,002 | 0 | - Existing spec durations on this machine: - `message-trash-batching`, desktop-chromium: 8.5 s / 9.2 s before, 3.5 s / 6.1 s after. - `message-trash-batching`, mobile-webkit: 12.1 s / 15.6 s before, 4.7 s / 11.8 s after. The conflicts-only test now waits for the progressive fill before its 5,001-row count. - The Chromium time left on the **Restore all** click (about 0.3–0.5 s, about 1.1 s at 4× throttle) is not trash code. In a Chromium trace, the focus change when the clicked button becomes disabled invalidates style for every descendant of the Chat Settings window (`allDescendantsMightBeInvalid`). That forces a whole-document style recalculation, about 85k elements with this list open. It happens for any focus change in that window and in baseline too. It's a likely follow-up; see the note below. ### Batch size: 100 → 200 (verification follow-up) With batches of 100, the existing conflicts-only `message-trash-batching` test (unchanged) clicks **Restore all** while the list is still filling in. It then waits for all 5,001 rows with `toHaveCount(5001)` and the default 10 s timeout. CI runs this spec about 3× slower than a local machine: on the 2026-10-07 nightly matrix it took 30.1 s on desktop-chromium and 51.6 s on mobile-webkit, against 9.2 s and 15.6 s locally. In a temporary copy of that test, time spent in the final `toHaveCount(5001)` wait: | Condition | Batches of 100 | Batches of 200 | | --- | --- | --- | | desktop-chromium, CDP CPU throttle 3× | 8.7–9.4 s | 6.2–7.2 s | | desktop-chromium, CDP CPU throttle 4× | ~15 s (the real 10 s assertion fails: 3,600/5,001 rows at 5×) | 9.4–10 s | | mobile-webkit, 6 parallel copies (local load) | 6.3–7.8 s | 3.9–5.0 s | | staging (all rows at once), 5× | rows already present; the open alone took 25.6 s | | A Chromium trace shows that each batch restyles only its own ~1.7k new elements and lays out only the ~2.4k new objects, so the cost is per row, not per list. Wrapping each batch in a `div` (plain, `contain: content` or `contain: layout style`) made WebKit's fill slower: 6.6–9.1 s against 5.1 s. Replacing `requestIdleCallback` with a 0 ms timer did not speed up Chromium under throttle. Fewer, larger batches were the one simple lever. I kept the 16 ms WebKit timer because a timer that is always ready could delay WebKit paints, and a heartbeat can't show that. The new spec's per-update limit and the CHANGELOG now say 200. Final numbers, 5,001 entries, Vite dev build, load average 3–5. "Max block" is the longest gap in a 10 ms heartbeat; p90 is over gaps above 50 ms. | Phase | Browser | staging | Batches of 100 | Batches of 200 (final) | | --- | --- | --- | --- | --- | | Open: first rows | Chromium | 1.75 s | 0.15–0.21 s | 0.20–0.25 s | | Open: all rows | Chromium | 1.97 s | 2.5–2.6 s | 2.2 s | | Open: max block (p90) | Chromium | 1.48 s | 0.24 s (0.085 s) | 0.23 s (0.125 s) | | Open: first rows | WebKit | 3.33 s | 0.25 s | 0.37 s | | Open: all rows | WebKit | 3.49 s | 5.8–5.9 s | 4.45–4.55 s | | Open: max block (p90) | WebKit | 3.0–3.2 s | 0.16 s (0.095 s) | 0.155–0.16 s (0.13–0.14 s) | | Restore all click: max block | Chromium / WebKit | 0.88 s / 2.1 s | 0.36–0.38 s / 0.06–0.09 s | 0.35–0.38 s / 0.08–0.13 s | | Response: max block | Chromium / WebKit | 0.91 s / 2.4 s | 0.07–0.08 s / 0.07–0.08 s | 0.07 s / 0.07–0.14 s | ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Agent-run checks: - `pnpm check` passed, including localization, format, lint, e2e types and build. - `pnpm localization:check` passed (no new strings). - These specs passed on `desktop-chromium` and `mobile-webkit`: `message-trash-batching`, `message-marks-trash` and the new `message-trash-responsive`. The existing specs are unchanged. - `message-trash-responsive` also passed with `--repeat-each=3` on `desktop-chromium`, `mobile-chromium` and `mobile-webkit`. Verification pass (after merging `origin/staging`, with batches of 200; head `63ed1ebbe`): - `pnpm check` passed (exit 0), including `localization:check`. - These specs passed on `desktop-chromium` and `mobile-webkit` (16/16): `message-trash-responsive`, `message-trash-batching`, `message-marks-trash`, `message-marks-colors` and `chat-settings-tools`. - `message-trash-responsive` and `message-trash-batching` passed with `--repeat-each=3 --workers=3` on all three projects (27/27). - `--repeat-each=3 --workers=4` over the three trash specs on desktop-chromium and mobile-webkit: 29/30. - The one failure is `message-marks-trash` roleplay on mobile-webkit: the fixture delete returned `trashed: false`. - The same command fails the same way on staging's component, so it predates this PR. That spec turns the global `messageTrash` feature on (off by default) and restores it in `finally`, so parallel repeats on one server switch it off under each other. - Negative control: on staging's component, the new spec fails on both engines (1,001 rows added in one update; limit 200). - Temporary probes (deleted), on both engines: - Restoring a row before the last batch renders keeps every other row exactly once, in order. - **Delete forever** confirmation moves between rows in different batches, and the second click deletes only that row. - **Empty trash** pressed mid-fill sends `{ all: true }` and shows the empty state. - **Restore all** pressed mid-fill sends every ID (2,001), and the list shrinks to the 50 conflicts. - When the list grows again, it refills in batches. - Switching to Search mid-fill and searching works, with no page errors. - The restore error toast is still visible after 8 s and its close button dismisses it. - The busy cover follows `--background` in light and dark themes. - In desktop Chromium, Tab order through the rows is unchanged. WebKit skips buttons on Tab by default, so it couldn't be checked there. - Row and batch render counts: with 1,001 entries, each row renders once and each batch once (StrictMode doubles the calls). The 6,501/8,503 figures above are the memo-removed control: 100×(1+…+10)+1,001 renders during the fill, plus 2×1,001 for the busy cycle. ### Manual verification notes - Manually verify in a browser: open **Chat Settings → Search messages → Trash** for a chat with a large trash (several thousand entries; the e2e fixture's mock works). The first entries should appear at once, the rest should fill in while you scroll, and the page should keep responding. - Manually verify: press **Restore all** on a large trash. The entries dim with a busy cursor, **Restore all** and **Empty trash** are disabled, and clicking or pressing Enter on a row's **Restore** or **Delete forever** does nothing until it finishes. - Manually verify: force a partial or failed restore (for example with the network tab blocking `/trash/restore`). The warning or error toast stays up for about 15 s. - Manually verify in light and dark mode, on desktop and a phone-width viewport: the trash header has a single dividing line under it, rows are separated as before, and no line appears under the last row. - Manually verify: delete forever on a single row still needs a second click (**Confirm delete**), and the confirm state moves when you click a different row. - Manually verify with a screen reader (VoiceOver or NVDA) during a held **Restore all**. The list should be reported as busy. Row **Restore** and **Delete forever** buttons can still be focused (unlike staging, where they were disabled), but activating one does nothing until the restore finishes. - Manually verify on a slow phone or with 4× CPU throttling: with several thousand entries, the list keeps filling in while you scroll, and the page still responds to taps between batches of 200. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Only `CHANGELOG.md` changed. `docs/chats/chat-settings.md` describes the Trash tab only in general terms, so no user docs changed. Possible follow-up, not filed: any focus change inside the Chat Settings window makes Chromium recalculate style for every element in the window (see Measurements). This is probably a Tailwind `group-focus-within:` / `:is(... *)` selector. It is independent of the trash, but a large list there makes it visible. ## UI evidence (if applicable) Not attached. The busy state dims the rows behind a cover instead of dimming only the row buttons. The idle look is unchanged. ## Local review I ran the local CodeRabbit CLI (0.7.6) once on the committed branch, and the verification pass ran it once more on the final branch (base `b5b46c786`). Both runs returned the same single finding, which I did not apply: - *Add `inert` to the row container while busy so keyboard users cannot focus or activate rows.* Not applied: toggling `inert` on the list restyles every row. In my measurements, `inert` plus a dim on the 5,001-row list blocked WebKit for about 3.4 s when a restore started, worse than before this PR, so it would undo the WebKit fix. The verification pass measured it again on the final code: with `inert={busy}`, WebKit blocked for 2.3–2.4 s on the **Restore all** click and 1.7 s on the response, against 0.08–0.13 s and 0.07 s without it. Chromium's response block rose from about 75 ms to 375 ms. Keyboard activation is already handled: `restoreEntry` and `deleteEntry` return early while `busyRef.current` is true. The new spec presses Enter on a covered row's **Restore** while **Restore all** is pending and checks that only one restore request was sent. The list also exposes `aria-busy` instead of being hidden from assistive technology. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Performance** * Message trash lists load up to 200 entries at a time, with additional entries added progressively. * Restoring or deleting messages avoids redrawing every entry, helping keep large trash lists responsive. * **Behavior** * Trash entries dim while restore or delete operations are in progress. * Restore failure and partial-restore warnings remain visible for 15 seconds. * Restore actions are unavailable while a restore operation is in progress. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:06:01 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7629
No description provided.