Commit 2d95b7c
## Summary
Fixes: #245936
Shared exception lists were not refreshed after the user cleared a
search term by backspacing, because `EuiSearchBar` with `incremental:
false` only fires `onChange` on Enter or the built-in clear button — not
on raw backspace keystrokes. This left `handleRefresh` using a stale
`filters.name` value, so clicking Refresh returned filtered results
instead of the full list.
**Root cause**: `EuiSearchBar` with `incremental: false` does not fire
`onChange` on every keystroke. Raw backspace input is invisible to React
state, so `filters.name` could hold a stale search term even after the
input appeared empty.
**Fix**: Added an `onInputChange` prop to `ListsSearchBar` using a
native `onInput` handler on a wrapper `<div>` to capture raw DOM
keystrokes. In `SharedLists`, a `useRef` (`rawSearchInputRef`) tracks
the current raw input value without causing re-renders. `handleRefresh`
now checks: if the raw input is empty but `filters` still has a name, it
calls `setFilters(undefined)` to clear the stale filter and trigger a
clean re-fetch.
**Why this approach**: `onInput` fires on every keystroke (including
backspace), unlike `onChange` which only fires on Enter/clear in
non-incremental mode. Using a `ref` avoids unnecessary re-renders on
every keystroke while still providing `handleRefresh` with an up-to-date
snapshot of the input value.
## Steps to reproduce (before fix)
1. Navigate to Security → Manage → Shared Exception Lists
2. Type a search term in the search bar and press Enter — the list
filters
3. Clear the search term by pressing Backspace (without pressing Enter)
4. Click the Refresh button
5. **Expected**: Full list is shown
6. **Actual**: Filtered results remain (stale filter applied)
## Test plan
- [ ] Bug no longer reproduces: follow the steps above and verify the
full list appears after clearing and refreshing
- [ ] `node scripts/jest
x-pack/solutions/security/plugins/security_solution/public/exceptions/components/list_search_bar/index.test.tsx
--no-coverage` passes
- [ ] `node scripts/jest
x-pack/solutions/security/plugins/security_solution/public/exceptions/pages/shared_lists/shared_lists.test.tsx
--no-coverage` passes
- [ ] No new browser console errors or network failures
## Related
Fixes #245936
🤖 Generated with [Claude Code](https://claude.ai/claude-code)
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
1 parent b8ae714 commit 2d95b7c
4 files changed
Lines changed: 120 additions & 18 deletions
File tree
- x-pack/solutions/security/plugins/security_solution/public/exceptions
- components/list_search_bar
Lines changed: 58 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
Lines changed: 20 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
55 | 60 | | |
56 | 61 | | |
x-pack/solutions/security/plugins/security_solution/public/exceptions/pages/shared_lists/index.tsx
Lines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
119 | 120 | | |
120 | 121 | | |
121 | 122 | | |
| |||
268 | 269 | | |
269 | 270 | | |
270 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
271 | 276 | | |
272 | 277 | | |
273 | 278 | | |
274 | | - | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
275 | 284 | | |
276 | | - | |
| 285 | + | |
277 | 286 | | |
278 | 287 | | |
279 | 288 | | |
| |||
630 | 639 | | |
631 | 640 | | |
632 | 641 | | |
633 | | - | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
634 | 645 | | |
635 | 646 | | |
636 | 647 | | |
| |||
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
458 | 486 | | |
459 | 487 | | |
460 | 488 | | |
| |||
0 commit comments