Skip to content

fix: chat visibility race condition and persistent fade timers#42

Merged
Extremelyd1 merged 1 commit intoExtremelyd1:mainfrom
Liparakis:ChatBoxFix
Mar 19, 2026
Merged

fix: chat visibility race condition and persistent fade timers#42
Extremelyd1 merged 1 commit intoExtremelyd1:mainfrom
Liparakis:ChatBoxFix

Conversation

@Liparakis
Copy link
Copy Markdown
Contributor

@Liparakis Liparakis commented Mar 19, 2026

Problem

  1. Command Feedback Race Condition: When a user submits a command (e.g., /tpa in @BobbyTheCatfish 's case), ChatBox.OnChatSubmit invokes the command and then immediately calls HideChatInput(). In the previous code, HideChatInput() explicitly called Hide() on every message, which nuked any new addon feedback before it could be rendered.
  2. Fade Timer Resets: The message fade-out timer (7.5s) was stored in a local coroutine variable. Opening and closing the chat would stop and restart the routine, resetting the timer to 0 and preventing messages from ever fading if the UI was toggled.

Solution

  • ChatBox.cs: Replaced the destructive Hide() loop in HideChatInput() with UpdateMessageVisibility(). This allows the UI to handle visibility state naturally, ensuring that newly added messages remain visible when the input area closes.
  • ChatMessage.cs: Migrated the fade timer state (_waitElapsed, _fadeElapsed) to class-level fields. The FadeRoutine now correctly pauses when the chat is open and resumes from its exact progress when the chat closes.

Copy link
Copy Markdown
Owner

@Extremelyd1 Extremelyd1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice description of the problem and solution, and clean fix!

@Extremelyd1 Extremelyd1 merged commit 41e3a39 into Extremelyd1:main Mar 19, 2026
3 checks passed
@Liparakis Liparakis deleted the ChatBoxFix branch March 25, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants