[PR #8910] [MERGED] perf(client): open chats and panels without waiting on the network #8877

Closed
opened 2026-11-07 17:40:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8910
Author: @Gunterlie
Created: 11/6/2026
Status: ✅ Merged
Merged: 11/6/2026
Merged by: @Gunterlie

Base: staging ← Head: perf/feel-3-instant-clicks


📝 Commits (4)

  • 1fe09e5 perf(client): open chats and panels without waiting on the network
  • b641cd2 fix(client): keep game and multiplayer chats on the detail before mounting
  • 39d073f fix(client): address Dottore review on instant chat and panel opens
  • 371dc35 test(e2e): type the cold-chat list filter without a type argument on the untyped query client

📊 Changes

10 files changed (+117 additions, -73 deletions)

View changed files

📝 e2e/advanced-memory-navigation.e2e.ts (+4 -0)
📝 packages/client/src/components/chat/ChatArea.tsx (+3 -2)
📝 packages/client/src/components/chat/RecentChats.tsx (+3 -0)
📝 packages/client/src/components/layout/AppShell.tsx (+17 -2)
📝 packages/client/src/components/layout/ChatSidebar.tsx (+10 -1)
📝 packages/client/src/components/layout/RightPanel.tsx (+4 -46)
📝 packages/client/src/components/layout/TopBar.tsx (+4 -1)
➕ packages/client/src/components/layout/right-panel-panels.ts (+21 -0)
📝 packages/client/src/hooks/use-chats.ts (+50 -20)
📝 packages/client/src/localization/locales/en.json (+1 -1)

📄 Description

Part of #8904.

Why

Opening a chat waited for two requests one after the other: the chat detail, then (only once it arrived) the transcript. Until the detail came back the whole chat area showed an opening state. The chat view and right-panel panels are lazy chunks, so the first chat or panel open in a session also waited for a code download, and React's Suspense throttle added up to 300 ms on top.

What changed

  • useChat starts from the chat's entry in the chat list cache (placeholderData). The chat view mounts immediately and the transcript request starts at once instead of after the detail. If the detail request fails, the existing opening/error state still shows (placeholder data is not kept on error).
  • Chat rows in the sidebar and on Home start the transcript request on pointerdown, before the click. Hook and prefetch share one query definition (chatMessagesQueryOptions).
  • The chat view and right panel load while the browser is idle after the first paint.
  • Right-panel panels use the existing preloadedLazy helper from a small module; hovering (or the pointerover of a tap on) a top-bar button preloads that panel, so the first open renders without a Suspense fallback.
  • Copy fix from #8905: the folder load error no longer says "Tap" on desktop.

Not done here: keepPreviousData on messages (unsafe: old messages under a new chat id), a dedicated transcript skeleton (the surfaces already get isMessagesLoading), Spotify lazy loading (follow-up).

Proof

Dev Mari, fresh page per run, 5 runs, medians. Numbers follow in a comment.

Manual verification

  • Manually verify opening a chat from the sidebar and from Home shows the chat at once, then the messages.
  • Manually verify switching quickly between two chats never shows the other chat's messages.
  • Manually verify a deleted or unreachable chat still shows the opening/error state with Retry and Back.
  • Manually verify game-mode chats still open on the right scene.
  • Manually verify each top-bar panel opens on first click (Characters, Lorebooks, Presets, Connections, Agents, Personas, Settings, Browser, Extensions).

🔄 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/8910 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 11/6/2026 **Status:** ✅ Merged **Merged:** 11/6/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `perf/feel-3-instant-clicks` --- ### 📝 Commits (4) - [`1fe09e5`](https://github.com/Pasta-Devs/Marinara-Engine/commit/1fe09e59d83e29cfb47f6fdef5987b26fdae7a5a) perf(client): open chats and panels without waiting on the network - [`b641cd2`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b641cd2ccc9cae708062beb773533559280977c8) fix(client): keep game and multiplayer chats on the detail before mounting - [`39d073f`](https://github.com/Pasta-Devs/Marinara-Engine/commit/39d073f1073aa22a892839376bb127998423e4b8) fix(client): address Dottore review on instant chat and panel opens - [`371dc35`](https://github.com/Pasta-Devs/Marinara-Engine/commit/371dc3591db150de93f329eda0e6ea086f86e200) test(e2e): type the cold-chat list filter without a type argument on the untyped query client ### 📊 Changes **10 files changed** (+117 additions, -73 deletions) <details> <summary>View changed files</summary> 📝 `e2e/advanced-memory-navigation.e2e.ts` (+4 -0) 📝 `packages/client/src/components/chat/ChatArea.tsx` (+3 -2) 📝 `packages/client/src/components/chat/RecentChats.tsx` (+3 -0) 📝 `packages/client/src/components/layout/AppShell.tsx` (+17 -2) 📝 `packages/client/src/components/layout/ChatSidebar.tsx` (+10 -1) 📝 `packages/client/src/components/layout/RightPanel.tsx` (+4 -46) 📝 `packages/client/src/components/layout/TopBar.tsx` (+4 -1) ➕ `packages/client/src/components/layout/right-panel-panels.ts` (+21 -0) 📝 `packages/client/src/hooks/use-chats.ts` (+50 -20) 📝 `packages/client/src/localization/locales/en.json` (+1 -1) </details> ### 📄 Description Part of #8904. ## Why Opening a chat waited for two requests one after the other: the chat detail, then (only once it arrived) the transcript. Until the detail came back the whole chat area showed an opening state. The chat view and right-panel panels are lazy chunks, so the first chat or panel open in a session also waited for a code download, and React's Suspense throttle added up to 300 ms on top. ## What changed - `useChat` starts from the chat's entry in the chat list cache (`placeholderData`). The chat view mounts immediately and the transcript request starts at once instead of after the detail. If the detail request fails, the existing opening/error state still shows (placeholder data is not kept on error). - Chat rows in the sidebar and on Home start the transcript request on `pointerdown`, before the click. Hook and prefetch share one query definition (`chatMessagesQueryOptions`). - The chat view and right panel load while the browser is idle after the first paint. - Right-panel panels use the existing `preloadedLazy` helper from a small module; hovering (or the pointerover of a tap on) a top-bar button preloads that panel, so the first open renders without a Suspense fallback. - Copy fix from #8905: the folder load error no longer says "Tap" on desktop. Not done here: `keepPreviousData` on messages (unsafe: old messages under a new chat id), a dedicated transcript skeleton (the surfaces already get `isMessagesLoading`), Spotify lazy loading (follow-up). ## Proof Dev Mari, fresh page per run, 5 runs, medians. Numbers follow in a comment. ## Manual verification - [ ] Manually verify opening a chat from the sidebar and from Home shows the chat at once, then the messages. - [ ] Manually verify switching quickly between two chats never shows the other chat's messages. - [ ] Manually verify a deleted or unreachable chat still shows the opening/error state with Retry and Back. - [ ] Manually verify game-mode chats still open on the right scene. - [ ] Manually verify each top-bar panel opens on first click (Characters, Lorebooks, Presets, Connections, Agents, Personas, Settings, Browser, Extensions). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:40:25 +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#8877
No description provided.