[Bug] duplicate messages when the chat gets hidden and re-shown with SSE enabled
Closed this issue · 0 comments
Fabilin commented
The issue
When the SSE feature is enabled, if the Chat
component gets dismounted then later remounted (typically because of a toggle button in the interface), any message received is displayed twice in the interface.
Diagnosis
This issue seems to be linked to #151. Indeed, the record storing which messages have been received by POST and which have been received by SSE is local to the useTock
hook and therefore to the Chat
component which uses it. This would not be an issue if the SSE connection was also local to this hook, but it is currently managed through global values. As an aside, this global SSE state would also prevent multiple SSE-enabled TOCK bots from co-existing on a single-page application.