mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8963] [MERGED] perf(shell): keep app-wide restyles and re-renders out of the sidebar slide #8918
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#8918
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8963
Author: @Gunterlie
Created: 11/7/2026
Status: ✅ Merged
Merged: 11/7/2026
Merged by: @Gunterlie
Base:
staging← Head:perf/sidebar-slide📝 Commits (4)
58390adperf(shell): keep app-wide restyles and re-renders out of the sidebar slidead3fcb7perf: stop :has() rules and the resize handle from restyling the whole app on DOM insertions71a8632fix: clear stale composer focus, place a shown bubble from live bounds, re-publish inset after remount0babf77fix: skip accent ticks only for the slot width slide; publish the inset at once when the slide is off📊 Changes
9 files changed (+95 additions, -39 deletions)
View changed files
📝
packages/client/src/App.tsx(+9 -2)📝
packages/client/src/components/characters/SpriteLibrary.tsx(+1 -1)📝
packages/client/src/components/chat/ChatRoleplaySurface.tsx(+2 -4)📝
packages/client/src/components/chat/EchoChamberPanel.tsx(+5 -2)📝
packages/client/src/components/layout/AppShell.tsx(+28 -7)📝
packages/client/src/components/layout/GlobalOmnibar.tsx(+14 -0)📝
packages/client/src/components/ui/FloatingWindow.tsx(+15 -9)📝
packages/client/src/styles/globals.css(+7 -0)📝
packages/client/src/styles/mari.css(+14 -14)📄 Description
Linked issue
Closes #8962
Why this change
Opening or closing a sidebar looks jittery and laggy. Profiling at 4x CPU slowdown shows that the slide itself is cheap: the slot width relayout costs about 8–20 ms for each toggle. The cost comes from work that runs during the slide:
--mari-chat-ui-inset-*on<html>in the click frame and on every resize-drag move. Any inline style on<html>restyles the whole app (about 150–220 ms at 4x).:has()rules made Chromium restyle about 1,900 elements on every DOM insertion anywhere in the app: a Tailwindgroup-has-*class in the sprite library, and the omnibar sheet's:not(:has(:focus)) > :not(...)rule. A sidebar toggle inserts a small topbar element, which triggered it. This likely also slows message streaming.What changed
FloatingWindow: live bounds pause while the window ishidden, and catch up before paint when it shows again.ChatRoleplaySurface/EchoChamberPanel: the panel reads sidebar state itself, so a toggle no longer renders the messages again.AppShell: the chat UI inset variables publish after the slide (220 ms) or after a resize drag pauses. The first publish is immediate. Only floating chat UI reads them.AppShell: both resize handles stay mounted and hide with thehiddenattribute.App: skip an accent tick while a shell panel slot transition runs.GlobalOmnibar+mari.css: the omnibar publishes composer focus asdata-mari-composer-focused; the sheet rules use that attribute instead of:has(:focus).SpriteLibrary+globals.css: the "rows keep their colour while a folder drags" hover rule is plain CSS instead of Tailwindgroup-has-*.A DOM insertion now restyles 19 elements instead of about 1,906.
Measurements
Headless Chromium, 1440×900, roleplay chat with 120 messages, 4x CPU slowdown, accent pulse on (default). Median of 5 toggles for each direction. "Frames" = frames painted in the first 300 ms after the click; "max gap" = longest time without a frame in that window.
The first frame after the click came after 364–507 ms before and after 2–71 ms now. Script time for each toggle fell from 188–246 ms to 114–155 ms.
Pulse off, 4x: left open 1 / 297 → 5 / 83, left close 1 / 300 → 6 / 67, right open 0 / 300 (first frame at 575 ms) → 4 / 133, right close 1 / 299 → 4 / 86.
No throttle (1x), pulse on: left open 9 / 83 → 13 / 67, left close 10 / 84 → 14 / 65, right open 6 / 133 → 11 / 67, right close 12 / 83 → 13 / 67.
Known limits (not in this PR)
The chat UI inset now follows a sidebar toggle or a resize drag about 220 ms late. During a drag, floating chat UI (game inventory, readable display, Chat Settings bubble, presence card) keeps the old offset until the drag pauses; a toolbar panel opened within 220 ms of a right-panel toggle anchors to the old inset. This is the trade-off for not restyling the whole app during the slide.
The deferred inset publish still causes one whole-page style recalculation about 220–300 ms after the slide. It no longer stalls the slide. Mobile is not affected, because the inset is always 0 in overlay mode. A follow-up can let the consumers read the inset from the store and set it locally.
At 4x, each slide frame still costs about 50–80 ms: about 25 ms paint, about 22 ms for the visible Chat Settings bubble that follows the chat, and about 20 ms layout.
Validation
pnpm checkpasses locallyCONTRIBUTING.mdManual verification notes
Agent checks on a local build (Playwright, Chromium): sidebar open/close at 1440, 768 and 390 px; resize by keyboard (ArrowRight) and mouse drag, with the inset following after the drag pauses; a hidden resize handle cannot take focus; five fast toggles settle with the slot state and inset in agreement; reduced motion has no slot transition; light/dark and default/SillyTavern themes; on a phone, the omnibar composer sets and clears
data-mari-composer-focused. Console: no page errors; the only failed requests are two/api/connections/<id>/modelscalls (400 and 502) for providers without valid keys in the test data. These also happen onstaging.Review: a Marinara reviewer pass found no blocking issues. Fixed from it: a composer that unmounts while focused no longer leaves the sheet flag set; a window shown again places its bubble from live bounds; a remount publishes the inset at once. The local CodeRabbit CLI could not run: the CodeRabbit server rejects the stored session ("Your CodeRabbit session or Git provider access could not be authenticated"), and a new login needs an interactive browser. CodeRabbit on GitHub reviews this PR instead.
Please verify manually:
Docs and release impact
docs-i18nbranch updated to match, or a[docs-i18n]follow-up issue opened (see CONTRIBUTING.md § Translated documentation)No docs or copy changes in this PR.
UI evidence (if applicable)
No visual change is intended. Screenshots at 390/768/1440 px in both modes match
staging.Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
[PR #8963] perf(shell): keep app-wide restyles and re-renders out of the sidebar slideto [PR #8963] [MERGED] perf(shell): keep app-wide restyles and re-renders out of the sidebar slide