Open
Description
Description
In packages/react-notion-x/src/components/search-dialog.tsx, It throttles the actual search frequency to 1 request / per second. but the _onChangeQuery
will always set isLoading
state to false every time the input value changed, which may result in a spinning state infinitely.
Suggested fix
Replace throttle
with debounce, and add the {trailing: true}
option.
import debounce from 'lodash.debounce'
export class SearchDialog extends React.Component {
componentDidMount() {
this._search = debounce(this._searchImpl.bind(this), 1000, {trailing: true})
this._warmupSearch()
}
}
Metadata
Metadata
Assignees
Labels
No labels