Set tslint semicolon rule and aply it to the project
[arvados.git] / src / components / main-app-bar / search-bar / search-bar.tsx
index d8c7edeeafa525c0edf0b4640945d1219a3fd314..f9e93d679c2973bf575b8e65173b028b384dbc9e 100644 (file)
@@ -15,24 +15,24 @@ interface SearchBarActionProps {
     debounce?: number;
 }
 
-type SearchBarProps = SearchBarDataProps & SearchBarActionProps & WithStyles<CssRules>
+type SearchBarProps = SearchBarDataProps & SearchBarActionProps & WithStyles<CssRules>;
 
 interface SearchBarState {
     value: string;
 }
 
-const DEFAULT_SEARCH_DEBOUNCE = 1000;
+export const DEFAULT_SEARCH_DEBOUNCE = 1000;
 
 class SearchBar extends React.Component<SearchBarProps> {
 
     state: SearchBarState = {
         value: ""
-    }
+    };
 
     timeout: NodeJS.Timer;
 
     render() {
-        const { classes } = this.props
+        const { classes } = this.props;
         return <Paper className={classes.container}>
             <form onSubmit={this.handleSubmit}>
                 <input
@@ -45,7 +45,11 @@ class SearchBar extends React.Component<SearchBarProps> {
                     <SearchIcon />
                 </IconButton>
             </form>
-        </Paper>
+        </Paper>;
+    }
+
+    componentDidMount() {
+        this.setState({value: this.props.value});
     }
 
     componentWillReceiveProps(nextProps: SearchBarProps) {
@@ -76,10 +80,10 @@ class SearchBar extends React.Component<SearchBarProps> {
 
 }
 
-type CssRules = 'container' | 'input' | 'button'
+type CssRules = 'container' | 'input' | 'button';
 
 const styles: StyleRulesCallback<CssRules> = theme => {
-    const { unit } = theme.spacing
+    const { unit } = theme.spacing;
     return {
         container: {
             position: 'relative',
@@ -100,7 +104,7 @@ const styles: StyleRulesCallback<CssRules> = theme => {
             width: unit * 3,
             height: unit * 3
         }
-    }
-}
+    };
+};
 
-export default withStyles(styles)(SearchBar)
\ No newline at end of file
+export default withStyles(styles)(SearchBar);
\ No newline at end of file