RocketChat / EmbeddedChat

An easy to use full-stack component (ReactJS) embedding Rocket.Chat into your webapp
https://www.npmjs.com/package/@embeddedchat/react
107 stars 214 forks source link

Fix: unwanted close call in ChatBody.js #600

Closed devanshkansagra closed 5 days ago

devanshkansagra commented 5 days ago

Removed the close statement in ChatBody.js

Spiral-Memory commented 5 days ago

LGTM. Can you please add one more change to this? Let's separate the useEffect which calls getMessagesAndRoles so that it doesn't affect the listeners.

Like this:

useEffect(() => {
  RCInstance.auth.onAuthChange((user) => {
    if (user) {
      getMessagesAndRoles();
    } else {
      getMessagesAndRoles(anonymousMode);
    }
  });
}, [RCInstance, anonymousMode, getMessagesAndRoles]);

image