@@ -9,7 +9,7 @@ import I18n from '../../../i18n';
99import { IAutocompleteItemProps , IComposerInput , IComposerInputProps , IInputSelection , TSetInput } from '../interfaces' ;
1010import { useAutocompleteParams , useFocused , useMessageComposerApi , useMicOrSend } from '../context' ;
1111import { fetchIsAllOrHere , getMentionRegexp } from '../helpers' ;
12- import { useSubscription , useAutoSaveDraft } from '../hooks' ;
12+ import { useAutoSaveDraft } from '../hooks' ;
1313import sharedStyles from '../../../views/Styles' ;
1414import { useTheme } from '../../../theme' ;
1515import { userTyping } from '../../../actions/room' ;
@@ -38,19 +38,18 @@ const defaultSelection: IInputSelection = { start: 0, end: 0 };
3838export const ComposerInput = memo (
3939 forwardRef < IComposerInput , IComposerInputProps > ( ( { inputRef } , ref ) => {
4040 const { colors, theme } = useTheme ( ) ;
41- const { rid, tmid, sharing, action, selectedMessages, setQuotesAndText } = useRoomContext ( ) ;
41+ const { rid, tmid, sharing, action, selectedMessages, setQuotesAndText, room } = useRoomContext ( ) ;
4242 const focused = useFocused ( ) ;
4343 const { setFocused, setMicOrSend, setAutocompleteParams } = useMessageComposerApi ( ) ;
4444 const autocompleteType = useAutocompleteParams ( ) ?. type ;
4545 const textRef = React . useRef ( '' ) ;
4646 const firstRender = React . useRef ( true ) ;
4747 const selectionRef = React . useRef < IInputSelection > ( defaultSelection ) ;
4848 const dispatch = useDispatch ( ) ;
49- const subscription = useSubscription ( rid ) ;
5049 const isMasterDetail = useAppSelector ( state => state . app . isMasterDetail ) ;
5150 let placeholder = tmid ? I18n . t ( 'Add_thread_reply' ) : '' ;
52- if ( subscription && ! tmid ) {
53- placeholder = I18n . t ( 'Message_roomname' , { roomName : ( subscription . t === 'd' ? '@' : '#' ) + getRoomTitle ( subscription ) } ) ;
51+ if ( room && ! tmid ) {
52+ placeholder = I18n . t ( 'Message_roomname' , { roomName : ( room . t === 'd' ? '@' : '#' ) + getRoomTitle ( room ) } ) ;
5453 if ( ! isTablet && placeholder . length > COMPOSER_INPUT_PLACEHOLDER_MAX_LENGTH ) {
5554 placeholder = `${ placeholder . slice ( 0 , COMPOSER_INPUT_PLACEHOLDER_MAX_LENGTH ) } ...` ;
5655 }
@@ -333,7 +332,7 @@ export const ComposerInput = memo(
333332 setAutocompleteParams ( { text : autocompleteText , type : ':' } ) ;
334333 return ;
335334 }
336- if ( lastWord . match ( / ^ ! / ) && subscription ?. t === 'l' ) {
335+ if ( lastWord . match ( / ^ ! / ) && room ?. t === 'l' ) {
337336 setAutocompleteParams ( { text : autocompleteText , type : '!' } ) ;
338337 return ;
339338 }
0 commit comments