mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[PR #239] [MERGED] fix(client): persist Author's Notes across outside-click dismissal #4522
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#4522
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/239
Author: @LukaTheHero
Created: 4/26/2026
Status: ✅ Merged
Merged: 4/26/2026
Merged by: @LukaTheHero
Base:
main← Head:fix/author-notes-save-race📝 Commits (1)
4741b8dfix(client): persist Author's Notes across outside-click dismissal📊 Changes
1 file changed (+29 additions, -1 deletions)
View changed files
📝
packages/client/src/components/chat/ChatRoleplayPanels.tsx(+29 -1)📄 Description
The bug
Open Author's Notes, type something, click outside the popover — typed content is lost some of the time.
Root cause
The outside-click handler in
AuthorNotesButtonfires onmousedownand callssetOpen(false), which unmounts the textarea before itsonBlur(the only save trigger) can run.onBluris the lone save path, so when it loses the race the edit is dropped.Big thanks to @Trade-Mottoes for surfacing this in #213 — the diagnosis there is spot on. I'm taking a different fix path here so we can keep the existing CSS/HTML structure and the no-explicit-save UX intact (Marinara prefers consistency with the existing infrastructure, and the popover should just persist what you typed without a Save button).
Fix
Flush pending edits from a
useEffectcleanup inAuthorNotesPanel.onBlur.mutateis fire-and-forget — the network request goes out fine after the component is gone.baselineRefsnapshot of the incomingchatMetagates the flush, so we only mutate when the user actually changed something (no spurious writes on simple peek-and-close).latestRefcarries the most recent textarea/depth values into the cleanup closure.onBlursave path is preserved — it still handles the tab-between-fields case where the popover stays mounted.What did NOT change
packages/client/src/components/chat/ChatRoleplayPanels.tsx(+29 / -1).Testing
pnpm checkpasses.Test plan
Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.