mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #8912] [MERGED] perf(client): instant message delete, chat rename and folder edits #8878
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#8878
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/8912
Author: @Gunterlie
Created: 11/6/2026
Status: ✅ Merged
Merged: 11/6/2026
Merged by: @Gunterlie
Base:
staging← Head:perf/feel-4-optimistic-actions📝 Commits (7)
5b13434perf(client): show message deletes, chat renames and folder edits at oncec60258cfix(client): refetch instead of restoring snapshots when an optimistic action fails5123d2afix(client): put back only the hidden items when an optimistic action fails5269acafix(client): show pending deletes, renames and folder edits on read instead of rewriting the cachefd8c251fix(client): refetch after refused actions and keep deletes hidden until the transcript refetchf8100e9fix(client): hide server-confirmed deletes on read and never shorten cached pages36734a5fix(client): end the hiding of confirmed deletes on any newer transcript fetch📊 Changes
6 files changed (+243 additions, -7 deletions)
View changed files
📝
packages/client/src/hooks/use-characters.ts(+31 -2)📝
packages/client/src/hooks/use-chats.ts(+103 -5)➕
packages/client/src/lib/character-group-cache.ts(+18 -0)📝
packages/client/src/lib/message-page-cache.ts(+21 -0)➕
scripts/regressions/character-group-cache.regression.ts(+33 -0)📝
scripts/regressions/message-page-cache.regression.ts(+37 -0)📄 Description
Part of #8904 (slice 4).
Why
Deleting a message, renaming a chat or editing a character folder waited for the server round-trip before the UI changed. On a slow box or a remote install that reads as "did my click work?". These actions now show at once and refetch from the server if it refuses (no snapshot restore, so changes that land during the request are kept).
What changed
The caches keep the server data. The queries show pending mutations on top of it through TanStack's
useMutationState+select, so a failed action simply stops being pending and nothing has to be put back.useChatMessageshides messages whose delete is pending, and after success keeps them hidden (small per-chat list) until the transcript refetch lands. The cached pages are never shortened, so Load more and page order stay correct. A refused delete just shows the message again and refetches.useChats,useChatanduseChatGroupshow the pending name at once. On success the server copy is written as before.useCharacterGroupsshows pending folder updates and deletes in order (applyGroupEditsinlib/character-group-cache.ts; members written as the JSON string the server stores). On success the edit is written to the cache, then the groups and catalog refresh.Validation
tsc --noEmit: pass.message-page-cacheregression (extended withremoveMessagesFromPages) and newcharacter-group-cacheregression (stacked edits, failed rename after a landed move, two failed edits, pending delete): pass.Manual checks
Review
CodeRabbit CLI auth is not available on this host; the
marinara-revieweragent and Dottore reviewed it. Earlier rounds rewrote the cache and restored on error; each restore variant lost data in some case (concurrent replies, unreachable server, shortened pages hiding Load more, stale indices, stacked folder edits). The current design avoids restores entirely by showing pending mutations on read.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.