appbaseio / appbaseio/reactivesearch

Controlled DataSearch autosuggestions not debounced

Open
#1,360 14 comments 4 reactions 1 assignee Claimed by @mohdashraf010897 View on GitHub
bug
Dominant language
JavaScript
Stars
4.9k
Forks
478
PR merge metrics
No merged PRs in 30d

Description

**Affected Projects**
React

**Library Version:** 3.x

**Describe the bug**
When you use a `` as a controlled component with `value` and `onValueChange` props the `componentDidUpdate` method calls `setValue` with `isDefaultValue=true`.

This means de-bouncing is ignored for the autosuggest query and causes the interface to be slow and places extra load on Elasticsearch.

Changing the `isDefaultValue` value to false in the `componentDidUpdate` method fixes the issue for me. I'm not sure how this parameter is used as it is explicitly set to `true` everywhere it is called inside `DataSearch`. The debounced key handler is only ever used if it is passed to `setValue` as `false`.

**Expected behavior**
When using `` as a controlled component, autosuggest queries should be debounced according to the value set on the `debounce` prop.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.