Skip to content

Commit

Permalink
Debounce keypresses to avoid wasted calls to windowStore when finding…
Browse files Browse the repository at this point in the history
… on page

Should fix brave#10271

Auditors: @NejcZdovc
  • Loading branch information
bsclifton authored and dfperry5 committed Aug 18, 2017
1 parent d2670f9 commit ca79cc8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/renderer/components/main/findbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const contextMenus = require('../../../../js/contextMenus')
const {getTextColorForBackground} = require('../../../../js/lib/color')
const frameStateUtil = require('../../../../js/state/frameStateUtil')
const {getSetting} = require('../../../../js/settings')
const debounce = require('../../../../js/lib/debounce')

// Styles
const globalStyles = require('../styles/global')
Expand All @@ -41,10 +42,11 @@ class FindBar extends React.Component {
this.onCaseSensitivityChange = this.onCaseSensitivityChange.bind(this)
this.onFind = this.onFind.bind(this)
this.onFindHide = this.onFindHide.bind(this)
this.onSetFindDetail = debounce(windowActions.setFindDetail, 100)
}

onInput (e) {
windowActions.setFindDetail(this.props.activeFrameKey, Immutable.fromJS({
this.onSetFindDetail(this.props.activeFrameKey, Immutable.fromJS({
searchString: e.target.value,
caseSensitivity: this.props.isCaseSensitive
}))
Expand Down

0 comments on commit ca79cc8

Please sign in to comment.