Changelog
Chat message overflow fix
Flub uses a lot of asynchronous code with message passing, and while I try to limit how much state is duplicated sometimes it goes wrong.
The chat messages are implemented using a feature called Streams. While these are really nice to work with, a downside is Flub doesn’t really know what messages are being displayed to each person. LiveView streams manage this by assigning an ID to each thing inside a stream, and then it uses the IDs of the changed things to update the UI as needed.
This normally works very well, but because Flub doesn’t have a database it doesn’t have a “default” sequence of IDs it can use that are guaranteed to be unique. This meant that when a new round started (and the ID sequence reset to zero), new messages would appear at the bottom of the chat, overwriting old ones sent in previous rounds.
What is interesting is that when I first started work on the redesign I did use something that generated unique IDs, but felt it was overkill as it didn’t really matter if different games had the same message IDs. Even something as simple as Flub has a lot of moving parts, and optimising something in one place can have unintended consequences where you don’t expect them.