stream-chat-react
stream-chat-react copied to clipboard
refactor: System message component is rendered within event message component
Motivation
EventComponent renders two types of messages:
- message of type
system - message carrying attribute
event
There may be 3 reasons why we want to separate those two into separate components:
- There is no reason why component containing word
Eventshould render system messages if it expects that messages of typesystemdo not carry attributeevent - System message is official type of message received from the back-end, meanwhile non-system message with attribute
eventis a custom message payload. And so, there is no reason, why integrators should know about this custom non-documented attribute. - The fact that message is of type
systemshould not exclude the possibility that it carries customeventattribute
Proposed solution
- separate code for rendering a message carrying attribute
eventinto a separate componentEventComponentand code for rendering system messages intoSystemMessagecomponent (theif (type === 'system'part) - the default component for system messages should be a new
SystemMessagecomponent - the
EventComponentwill not keep theif (type === 'system')branch
This will be a breaking change for those who are using EventComponent to display system messages in their custom code.
Hello! Any updates on a timeline for this improvement?
Hello @jakedeg! We do not have a specific timeline for this issue at the moment and we keep it in our backlog.