From ab844b6fcc7f9f81c04f8aa6f88a1f1231f27e79 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Mon, 11 Jun 2018 22:32:33 +0200 Subject: [PATCH] Add search bar component unmount handler, clean up search bar code Feature #13590 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- .../main-app-bar/search-bar/search-bar.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/main-app-bar/search-bar/search-bar.tsx b/src/components/main-app-bar/search-bar/search-bar.tsx index b2c95a93..d8c7edee 100644 --- a/src/components/main-app-bar/search-bar/search-bar.tsx +++ b/src/components/main-app-bar/search-bar/search-bar.tsx @@ -3,12 +3,8 @@ // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; -import { AppBar, Toolbar, Typography, Grid, IconButton, Badge, Paper, Input, StyleRulesCallback, withStyles, WithStyles } from '@material-ui/core'; -import NotificationsIcon from '@material-ui/icons/Notifications'; -import PersonIcon from '@material-ui/icons/Person'; -import HelpIcon from '@material-ui/icons/Help'; +import { IconButton, Paper, StyleRulesCallback, withStyles, WithStyles } from '@material-ui/core'; import SearchIcon from '@material-ui/icons/Search'; -import { AppBarProps } from '@material-ui/core/AppBar'; interface SearchBarDataProps { value: string; @@ -23,7 +19,6 @@ type SearchBarProps = SearchBarDataProps & SearchBarActionProps & WithStyles { state: SearchBarState = { - value: "", - prevValue: "" + value: "" } timeout: NodeJS.Timer; @@ -60,6 +54,10 @@ class SearchBar extends React.Component { } } + componentWillUnmount() { + clearTimeout(this.timeout); + } + handleSubmit = (event: React.FormEvent) => { event.preventDefault(); clearTimeout(this.timeout); -- 2.30.2