Skip to content

Commit 0210468

Browse files
authored
[ML] Anomaly Explorer: Prevent crash on anomaly table filter (elastic#213075)
Fix for: elastic#212569 From what I found, the issue was with the `useUrlStateService` after changes introduced in elastic#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
1 parent 3fdb04d commit 0210468

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

x-pack/platform/packages/private/ml/url_state/src/url_state.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ export const useUrlStateService = <K extends Accessor, T>(
291291
? state?.[optionsRef.current.pageKey]
292292
: state;
293293

294-
const setCallback = useRef<typeof setState>();
294+
const setCallback = useRef<typeof setState>(setState);
295295

296296
useEffect(() => {
297297
setCallback.current = setState;

0 commit comments

Comments
 (0)