File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed
packages/frontend/src/components/screens/MainScreen Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -397,20 +397,10 @@ function ChatHeading({ chat }: { chat: T.FullChat }) {
397397 const openViewProfileDialog = useOpenViewProfileDialog ( )
398398 const accountId = selectedAccountId ( )
399399
400- const [ firstChatContact , setFirstChatContact ] = useState < T . Contact | null > (
401- null
402- )
403- useEffect ( ( ) => {
404- BackendRemote . rpc
405- . getContact ( accountId , chat . contactIds [ 0 ] )
406- . then ( setFirstChatContact )
407- . catch (
408- log . error . bind (
409- null ,
410- 'error fetching first contact of chat for chat subtitle'
411- )
412- )
413- } , [ chat . contactIds , accountId ] )
400+ const firstChatContact = useRpcFetch ( BackendRemote . rpc . getContact , [
401+ accountId ,
402+ chat . contactIds [ 0 ] ,
403+ ] )
414404
415405 const onTitleClick = ( ) => {
416406 if ( ! chat ) {
@@ -470,7 +460,10 @@ function ChatHeading({ chat }: { chat: T.FullChat }) {
470460 }
471461 }
472462
473- const subtitle = chatSubtitle ( chat , firstChatContact )
463+ const subtitle = chatSubtitle (
464+ chat ,
465+ firstChatContact . result ?. ok ? firstChatContact . result ?. value : null
466+ )
474467
475468 return (
476469 < div className = 'navbar-heading' data-no-drag-region >
You can’t perform that action at this time.
0 commit comments