File tree Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Expand file tree Collapse file tree 1 file changed +6
-14
lines changed Original file line number Diff line number Diff line change @@ -52,21 +52,13 @@ const Chat = ({
5252 const clientMutes = client ?. user ?. mutes ;
5353
5454 useEffect ( ( ) => {
55- const setUserAgent = ( ) => {
56- const userAgent = client . getUserAgent ( ) ;
57- if ( ! userAgent . includes ( 'stream-chat-react' ) ) {
58- // should result in something like:
59- // 'stream-chat-react-2.3.2-stream-chat-javascript-client-browser-2.2.2'
60- client . setUserAgent ( `stream-chat-react-${ version } -${ userAgent } ` ) ;
61- }
62- } ;
63-
64- if ( client ) {
65- setUserAgent ( ) ;
55+ if ( ! client ) return ;
56+ const userAgent = client . getUserAgent ( ) ;
57+ if ( ! userAgent . includes ( 'stream-chat-react' ) ) {
58+ // should result in something like:
59+ // 'stream-chat-react-2.3.2-stream-chat-javascript-client-browser-2.2.2'
60+ client . setUserAgent ( `stream-chat-react-${ version } -${ userAgent } ` ) ;
6661 }
67- // don't want client in dep array because it is a required
68- // prop for this component and we only want this run on mount
69- // eslint-disable-next-line react-hooks/exhaustive-deps
7062 } , [ client ] ) ;
7163
7264 useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments