mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ML] Anomaly Explorer: Prevent crash on anomaly table filter (#213075)
Fix for: https://github.com/elastic/kibana/issues/212569 From what I found, the issue was with the `useUrlStateService` after changes introduced in https://github.com/elastic/kibana/pull/203224, which made the service more generic. When filtering causes the `explorer` to remount the `AnomaliesTable`, pagination state updates are triggered before the effect that sets `setCallback.current` executes. Initializing the ref with `setState` ensures its availability from the first render. https://github.com/user-attachments/assets/d1aa8409-56e5-4632-a5f2-82350b877db6
This commit is contained in:
parent
3fdb04d294
commit
0210468548
1 changed files with 1 additions and 1 deletions
|
@ -291,7 +291,7 @@ export const useUrlStateService = <K extends Accessor, T>(
|
|||
? state?.[optionsRef.current.pageKey]
|
||||
: state;
|
||||
|
||||
const setCallback = useRef<typeof setState>();
|
||||
const setCallback = useRef<typeof setState>(setState);
|
||||
|
||||
useEffect(() => {
|
||||
setCallback.current = setState;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue