Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

fix: Clear SearchBox without search as you type #802

Merged
merged 2 commits into from
Jan 7, 2018

Conversation

samouss
Copy link
Collaborator

@samouss samouss commented Jan 5, 2018

Summary

Fix #799

When the button reset is clicked the query should be clear. But it's only works when the searchAsYouType is true since we are using the same function for the reset & change event. Now we don't use the same function for both events.

In a future refactoring we can probably avoid to handle the state of the query with two different cases (control & uncontrol). We could move for a full control input with a copy of the current refinement in the local state. It will avoid to have two sources of truth in the component.

Before

before

After

after

You can also play with the example on Storybook.

@samouss samouss changed the title Fix/clear searchbox without search as you type fix: Clear SearchBox without search as you type Jan 5, 2018
@algobot
Copy link
Contributor

algobot commented Jan 5, 2018

Deploy preview ready!

Built with commit 4e6c72f

https://deploy-preview-802--react-instantsearch.netlify.com

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a good change, your remark about the refactor makes sense

@samouss samouss force-pushed the fix/clear-searchbox-without-search-as-you-type branch 2 times, most recently from 15fa851 to 123eb15 Compare January 5, 2018 12:09
@samouss samouss requested a review from vvo January 5, 2018 17:01
@samouss samouss force-pushed the fix/clear-searchbox-without-search-as-you-type branch from 123eb15 to 4e6c72f Compare January 7, 2018 10:08
@samouss samouss merged commit c49b2b6 into master Jan 7, 2018
@samouss samouss deleted the fix/clear-searchbox-without-search-as-you-type branch January 7, 2018 10:24
samouss added a commit that referenced this pull request Jan 9, 2018
<a name="4.4.1"></a>
## [4.4.1](v4.4.0...v4.4.1) (2018-01-09)

### Bug Fixes

* **SearchBox**: clear SearchBox without search as you type ([#802](#802)) ([c49b2b6](c49b2b6))
* **connectRange:** check if facet exist before access ([#797](#797)) ([6520760](6520760))
* **stories:** avoid to use linear-background it breaks Argos every time ([#804](#804)) ([0beded7](0beded7))
* **stories:** limit hits per page on Index ([#806](#806)) ([6eb14d3](6eb14d3))

### Features

* **Index:** allow custom root ([#792](#792)) ([d793b0a](d793b0a))
Haroenv added a commit that referenced this pull request Sep 29, 2022
<!--
  Thanks for submitting a pull request!
Please provide enough information so that others can review your pull
request.
-->

**Summary**

<!--
  Explain the **motivation** for making this change.
  What existing problem does the pull request solve?
  Are there any linked issues?
-->

Similarly as #802, when reset is triggered and searchAsYouType is false,
a search should still happen.

**Result**

fixes #3641

<!--
  Demonstrate the code is solid.
  Example: The exact commands you ran and their output,
  screenshots / videos if the pull request changes UI.
-->
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants