[GH-ISSUE #547] [Issue]: Background image changes incorrectly when swapping between chats #248

Closed
opened 2026-10-20 17:26:46 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @aidanbrocklebank on GitHub (May 8, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/547

Originally assigned to: @cha1latte on GitHub.

Summary

Moving between roleplay chats too quickly can fail to update the background image to the correct file, leaving the background image for the previous chat showing. This can also overwrite the background image URL associated with the swapped-to chat.

Expected behavior

Every roleplay chat should have an associated background, which only changes when the user changes it in settings or when the "Background" agent changes it. The background image associated with the currently selected roleplay chat should be displayed.

Actual behavior

Swapping between two roleplay chats sometimes fails to update the background image, leaving the background for the former chat displayed behind the latter chat. This also rewrites the saved background for the latter roleplay chat.

Steps to reproduce

  1. Set up two roleplay chats, A and B, with two distinct backgrounds.
  2. Swap from chat A to chat B, then swiftly back.
  3. Chat A will now the the background originally assigned to chat B.

This may not happen every time, due to the race condition.

Environment

  • Marinara Engine version: v1.5.8
  • Install type: Git
  • OS + version: Windows 11
  • Browser or app shell: Firefox, Chrome

Logs, screenshots, or video

Additional context

This is related but distinct to #260.

My understanding is that this is the result of the two background-related useEffects in ChatArea.tsx both having chat?.id as a dependency, meaning they can race each other and happen in the wrong order. The timeout that delays persisting the filename also contributes inconsistency.

I have a working fix locally that I can make into a PR.

Template check

Please uncheck (untick) the box below before submitting so we know you read the template. It is intentionally pre-checked:

  • I DID NOT read this template and provide the requested details.
Originally created by @aidanbrocklebank on GitHub (May 8, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/547 Originally assigned to: @cha1latte on GitHub. ## Summary Moving between roleplay chats too quickly can fail to update the background image to the correct file, leaving the background image for the previous chat showing. This can also overwrite the background image URL associated with the swapped-to chat. ## Expected behavior Every roleplay chat should have an associated background, which only changes when the user changes it in settings or when the "Background" agent changes it. The background image associated with the currently selected roleplay chat should be displayed. ## Actual behavior Swapping between two roleplay chats sometimes fails to update the background image, leaving the background for the former chat displayed behind the latter chat. This also rewrites the saved background for the latter roleplay chat. ## Steps to reproduce 1. Set up two roleplay chats, A and B, with two distinct backgrounds. 2. Swap from chat A to chat B, then swiftly back. 3. Chat A will now the the background originally assigned to chat B. This may not happen every time, due to the race condition. ## Environment - Marinara Engine version: v1.5.8 - Install type: Git - OS + version: Windows 11 - Browser or app shell: Firefox, Chrome ## Logs, screenshots, or video <!-- Paste relevant logs and add screenshots when possible --> ## Additional context This is related but distinct to #260. My understanding is that this is the result of the two background-related `useEffect`s in `ChatArea.tsx` both having `chat?.id` as a dependency, meaning they can race each other and happen in the wrong order. The timeout that delays persisting the filename also contributes inconsistency. I have a working fix locally that I can make into a PR. ## Template check Please **uncheck (untick)** the box below before submitting so we know you read the template. It is intentionally pre-checked: - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-20 17:26:46 +07:00
  • closed this issue
  • added the
    bug
    label
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#248
No description provided.