NotionX / NotionX/react-notion-x
Search dialog could spin infinitely
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 645
- PR merge metrics
- No merged PRs in 30d
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()
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/react-notion-x/src/components/search-dialog.tsx and trace how _onChangeQuery, _search, and isLoading interact while the query changes. Verify the search scheduling and loading state behavior, then confirm that repeated input no longer leaves the dialog spinning indefinitely.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100