-
Notifications
You must be signed in to change notification settings - Fork 860
[EuiSearchBar] Make onChange args type simple, as before #9253
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
Conversation
this is reverting a change introduced in elastic#9142 for EuiSearchBarOnChangeArgs, where the query prop could be null also when there was no error, requiring additional checks in consumer code
|
@mgadewoll updated the changelog so it's a minor instead of a patch in 08d6dc6 — suggestions welcome! |
💚 Build SucceededHistory
cc @acstll |
💚 Build Succeeded
History
cc @acstll |
| @@ -0,0 +1,2 @@ | |||
| - Updated `EuiSearchBarOnChangeArgs` to restore proper type narrowing when checking for `error` (regression from #9142), decoupling `searchFormat="text"` behavior in `EuiInMemoryTable` from `EuiSearchBar` | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Imho, we should an entry for the updated search prop type that uses EuiInMemoryTableSearchBarProps now.
And considering that this will require updates to implementations due to an API change (though small), I'd even mark it as breaking.
👆 this (that I wrote in the description above) is actually not true, because whenever after gathering feedback in a couple of discussions, I'm leaning towards thinking that the original change in #9142 that added if you agree, I'd close this and put up another PR with just a few JSDoc additions… — @mgadewoll what do you think? |
Agreed, that sounds sensible. The current approach works fine. And as you say, if the EuiSearchBar does receive |
|
for reasons stated above, let's close this in favor of only improving JSDoc around the current types — thank you @mgadewoll @weronikaolejniczak @tkajtoch 🙏 |

Summary
This is reverting a change introduced in #9142 for the
EuiSearchBarOnChangeArgstype, where thequeryprop could benullalso when there was noerror, requiring additional checks in consumer code.Why are we making this change?
To prevent type errors in consumer code.
Before (in #9142)
with the above,
querycould be null also whenerroris null (no error); so checking for!args.erroris not enough to ensurequerynot being nullAfter
now when
erroris null,queryhas a value different than null 👍 (as it used to be)Impact to users
🟡 Changes required. Any usages of
EuiSearchBarPropsfor thesearchprop inEuiInMemoryTableneed to be replaced with the newEuiInMemoryTableSearchBarProps, as theonChangetype is different between them.Thank you @mgadewoll for preparing these:
QA
General checklist
@defaultif default values are missing) and playground toggles