@@ -20,10 +20,8 @@ import { throttle } from 'lodash';
20
20
import classNames from 'classnames' ;
21
21
22
22
import { Key } from '../../Keyboard' ;
23
- import dis from '../../dispatcher/dispatcher' ;
24
23
import AccessibleButton from '../../components/views/elements/AccessibleButton' ;
25
24
import { replaceableComponent } from "../../utils/replaceableComponent" ;
26
- import { Action } from '../../dispatcher/actions' ;
27
25
28
26
interface IProps extends HTMLProps < HTMLInputElement > {
29
27
onSearch ?: ( query : string ) => void ;
@@ -37,11 +35,6 @@ interface IProps extends HTMLProps<HTMLInputElement> {
37
35
autoFocus ?: boolean ;
38
36
initialValue ?: string ;
39
37
collapsed ?: boolean ;
40
-
41
- // If true, the search box will focus and clear itself
42
- // on room search focus action (it would be nicer to take
43
- // this functionality out, but not obvious how that would work)
44
- enableRoomSearchFocus ?: boolean ;
45
38
}
46
39
47
40
interface IState {
@@ -51,13 +44,8 @@ interface IState {
51
44
52
45
@replaceableComponent ( "structures.SearchBox" )
53
46
export default class SearchBox extends React . Component < IProps , IState > {
54
- private dispatcherRef : string ;
55
47
private search = createRef < HTMLInputElement > ( ) ;
56
48
57
- static defaultProps : Partial < IProps > = {
58
- enableRoomSearchFocus : false ,
59
- } ;
60
-
61
49
constructor ( props : IProps ) {
62
50
super ( props ) ;
63
51
@@ -67,31 +55,6 @@ export default class SearchBox extends React.Component<IProps, IState> {
67
55
} ;
68
56
}
69
57
70
- public componentDidMount ( ) : void {
71
- this . dispatcherRef = dis . register ( this . onAction ) ;
72
- }
73
-
74
- public componentWillUnmount ( ) : void {
75
- dis . unregister ( this . dispatcherRef ) ;
76
- }
77
-
78
- private onAction = ( payload ) : void => {
79
- if ( ! this . props . enableRoomSearchFocus ) return ;
80
-
81
- switch ( payload . action ) {
82
- case Action . ViewRoom :
83
- if ( this . search . current && payload . clear_search ) {
84
- this . clearSearch ( ) ;
85
- }
86
- break ;
87
- case 'focus_room_filter' :
88
- if ( this . search . current ) {
89
- this . search . current . focus ( ) ;
90
- }
91
- break ;
92
- }
93
- } ;
94
-
95
58
private onChange = ( ) : void => {
96
59
if ( ! this . search . current ) return ;
97
60
this . setState ( { searchTerm : this . search . current . value } ) ;
@@ -137,7 +100,7 @@ export default class SearchBox extends React.Component<IProps, IState> {
137
100
public render ( ) : JSX . Element {
138
101
/* eslint @typescript-eslint/no-unused-vars: ["error", { "ignoreRestSiblings": true }] */
139
102
const { onSearch, onCleared, onKeyDown, onFocus, onBlur, className = "" , placeholder, blurredPlaceholder,
140
- autoFocus, initialValue, collapsed, enableRoomSearchFocus , ...props } = this . props ;
103
+ autoFocus, initialValue, collapsed, ...props } = this . props ;
141
104
142
105
// check for collapsed here and
143
106
// not at parent so we keep
0 commit comments