Repository navigation
perf(ui-react): memoize stable session rows - #514
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SessionRowrender boundary insideSessionHistoryList.AppShell -> SessionListPanelsidebar inputs soonSelectSessionandrowActionsno longer churn on unrelated AppShell renders.SessionHistoryListpath withrowActionspresent, unrelated parent updates, and a single-row streaming update.Why
Refs #477
PR9 is the evidence-based memo pass after the React cleanup series.
SessionRowhas local hover/edit/pending state and sits under a sidebar owner that can rerender for unrelated parent state. The first pass memoized the row, but review found the real AppShell owner still passed a fresh select handler and fresh row action object every render, which would defeat the memo boundary on the hot sidebar path. This update makes those owner props stable while still dispatching to the latest action handlers through refs.Scope
Changed:
packages/ui/src/session-history-list.tsx: wrap privateSessionRowwith Reactmemo.apps/desktop/src/renderer/app-shell.tsx: pass stablesessionListSelectSessionand stablesessionRowActionsintoSessionListPanel.apps/desktop/src/main/__tests__/ui-render-memo-boundary-contract.test.ts: keep only the publicSessionHistoryListrender-count contract; it no longer source-scans AppShell, regex-injectsSessionRow, or mocks@maka/core.apps/desktop/src/main/__tests__/session-row-actions-fail-soft-contract.test.ts: keep owner no-inline and fail-soft row action wiring checks in the existing AppShell wiring contract.Not included:
ToolActivitymemo boundary without render evidence.ChatViewor AppShell split.Verification
ui-render-memo-boundary-contractfailed becausesessionListSelectSession/sessionRowActionsdid not exist andSessionListPanelstill received inline props.npm run -w @maka/ui buildnpm run -w @maka/desktop build:main && node --test apps/desktop/dist/main/__tests__/ui-render-memo-boundary-contract.test.js apps/desktop/dist/main/__tests__/session-row-actions-fail-soft-contract.test.js(5 passed)npm run -w @maka/desktop build:renderer(passes; existing Vite large chunk warning remains)npm run -w @maka/desktop test(1864 passed)npm run -w @maka/ui teststill fails on the pre-existingchat-primitives.testfooter/lineage merge assertions (gap-[6px],gap-[3px]); this PR does not touch those files or classes.User-facing impact
No behavior or visual change intended. Sidebar session rows should do less React work when parent/sidebar state changes without changing the row props.
Reviewer notes
Review fix commits:
5e8e2028 perf(ui-react): stabilize sidebar row inputs654bb91d test(ui-react): slim sidebar memo contractThe render-count test still bundles the built UI file so React client rendering can run inside the Node desktop test environment without adding a DOM test dependency, but the temporary bundle now only replaces OverlayScrollbars' browser-only side effect. It uses the real
@maka/coreformatter and the builtpackages/ui/dist/session-history-list.jsoutput. Owner no-inline coverage moved to the existing AppShell row-action wiring contract, where re-inliningonSelectSessionorrowActionsfails the test.