stream-chat-react icon indicating copy to clipboard operation
stream-chat-react copied to clipboard

refactor: System message component is rendered within event message component

Open MartinCupela opened this issue 2 years ago • 2 comments

Motivation EventComponent renders two types of messages:

  1. message of type system
  2. message carrying attribute event

There may be 3 reasons why we want to separate those two into separate components:

  1. There is no reason why component containing word Event should render system messages if it expects that messages of type system do not carry attribute event
  2. System message is official type of message received from the back-end, meanwhile non-system message with attribute event is a custom message payload. And so, there is no reason, why integrators should know about this custom non-documented attribute.
  3. The fact that message is of type system should not exclude the possibility that it carries custom event attribute

Proposed solution

  1. separate code for rendering a message carrying attribute event into a separate component EventComponent and code for rendering system messages into SystemMessage component (the if (type === 'system' part)
  2. the default component for system messages should be a new SystemMessage component
  3. the EventComponent will not keep the if (type === 'system') branch

This will be a breaking change for those who are using EventComponent to display system messages in their custom code.

MartinCupela avatar May 20 '22 11:05 MartinCupela

Hello! Any updates on a timeline for this improvement?

jakedeg avatar Jan 13 '23 18:01 jakedeg

Hello @jakedeg! We do not have a specific timeline for this issue at the moment and we keep it in our backlog.

MartinCupela avatar Jan 17 '23 21:01 MartinCupela