Skip to content

Fix live message ordering during chat log restoration - #339

Merged
mrbuilder1961 merged 2 commits into
mrbuilder1961:omniversfrom
NineOfGaming:fix/chat-restore
Aug 14, 2026
Merged

Fix live message ordering during chat log restoration#339
mrbuilder1961 merged 2 commits into
mrbuilder1961:omniversfrom
NineOfGaming:fix/chat-restore

Conversation

@NineOfGaming

Copy link
Copy Markdown
Contributor

Fixes #263.

Live chat messages can arrive while the saved chat log is still being deserialized.
Those messages were displayed and persisted immediately, then pushed behind the saved history when restoration finished.

This change queues live messages until restoration completes, ensuring the saved history remains the base and new messages appear afterward in their original arrival order.

  • Added explicit chat restoration states.
  • Sets the state to LOADING before asynchronous deserialization starts.
  • Captures incoming messages and their associated metadata while loading.
  • Restores saved history before replaying queued messages in FIFO order.
  • Replays messages through the normal ChatComponent.addMessage path so formatting, duplicate condensation, and persistence still run normally.
  • Ensures failures cannot leave chat permanently stuck in a loading state.

Also switched TextColor.formatValue() to its public equivalent, TextColor.serialize(), fixing compilation on 26.x without changing formatting behavior.

@mrbuilder1961

Copy link
Copy Markdown
Owner

omg this is so so awesome! i've been meaning to do this but life is so busy and i really appreciate you contributing to the mod!! there are a couple of things i have questions about so i will ask those per-line so context is available - but THANK YOU!

this is awesome.

Comment thread src/main/java/obro1961/chatpatches/mixin/gui/ChatComponentMixin.java Outdated
Comment thread src/main/java/obro1961/chatpatches/mixin/gui/ChatComponentMixin.java Outdated
Comment thread src/main/java/obro1961/chatpatches/ChatLog.java Outdated
Comment thread src/main/java/obro1961/chatpatches/ChatLog.java
Comment thread src/main/java/obro1961/chatpatches/ChatLog.java
Comment thread src/main/java/obro1961/chatpatches/ChatLog.java Outdated
Comment thread src/main/java/obro1961/chatpatches/ChatLog.java Outdated
Comment thread src/main/java/obro1961/chatpatches/ChatLog.java Outdated
Comment thread src/main/java/obro1961/chatpatches/ChatLog.java Outdated
Comment thread src/main/java/obro1961/chatpatches/ChatLog.java Outdated
Comment thread src/main/java/obro1961/chatpatches/ChatLog.java Outdated
@mrbuilder1961

Copy link
Copy Markdown
Owner

most of these are nitpicks but look over the few important ones, and once you fix those i should be good to merge! again thank you so so much for your contribution and i hope to see you around the community! apologies for any nonsensical comments; it's late rn 😵

@mrbuilder1961

Copy link
Copy Markdown
Owner

thanks for the quick fixes, i really appreciate your cooperation!
i assume you've tested everything yourself, but once you've explicitly confirmed that you've done so, i'll be happy to merge this PR!
additionally, i recommend you join the discord where you will receive a special role for your efforts. thx!

@NineOfGaming

Copy link
Copy Markdown
Contributor Author

yes, tested on all versions, everything should be working 👍

@mrbuilder1961
mrbuilder1961 merged commit feb5945 into mrbuilder1961:omnivers Aug 14, 2026
1 check passed
mrbuilder1961 added a commit that referenced this pull request Aug 14, 2026
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.

Chat log can load late, pushing new messages to the back/top

2 participants