-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove componentWillReceiveProps()
in AutoSearchInput
#12597
Comments
I think the test case may be correct. If typing in the input box changes I would suggest investigating what kind of re-render situations could affect this. Maybe hot reloading? Maybe a URL change? In the case that you can't find any, it seems to me that |
Thanks a lot for your input! I hate removing test cases without a good reason. I'll see what I can do because that seems to be slightly against the reactive model introduced by React. |
@kumar303 so, we actually hit the anti-pattern described here: https://reactjs.org/blog/2018/06/07/you-probably-dont-need-derived-state.html#anti-pattern-erasing-state-when-props-change We should use the |
I looked into how Notes:
|
👍
I think |
I fixed the component. |
@willdurand Testing scenarios for qa in #12323 were:
Is that what it needs to be done here too? |
oops, I forgot to update the description. You can test the search bar. |
Verified fixed on AMO stage with FF63, Win10x64 and Android 8.0 The search bar from the page header and from the collection edit page is working as intended. |
See also: #12323
The following patch works but one test case is still failing (see after the patch):
Here is the failing test case:
● /Users/williamdurand/projects/mozilla/addons-frontend/tests/unit/amo/components/TestAutoSearchInput.js › search input › only sets an updated query if it is unique
From what I understand, the test case tries to cover the following scenario:
query
propquery
prop is NOT copied to the component's state that timeI find this scenario a bit weird because we assume a state property can be updated by two different "sources", yet not always.
Is that a real life scenario?For QA: please make sure the search bar still works as intended.
The text was updated successfully, but these errors were encountered: