From 08dd4bdbb79a3ad72cf0a23679a19342f1314356 Mon Sep 17 00:00:00 2001 From: nklhrstv Date: Mon, 3 Feb 2020 18:06:54 +0200 Subject: [PATCH] handle prop change in useModelState --- src/common/useModelState.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/useModelState.js b/src/common/useModelState.js index 9d949df36..277b1c943 100644 --- a/src/common/useModelState.js +++ b/src/common/useModelState.js @@ -8,7 +8,7 @@ const UNLOAD_ACTION = { action: 'Unload', }; -const useModelState = ({ model, action, timeout, onNewState, map, mapWithCtx, init }) => { +const useModelState = ({ model, init, action, timeout, onNewState, map, mapWithCtx }) => { const modelRef = React.useRef(model); const mountedRef = React.useRef(false); const { core } = useServices(); @@ -52,7 +52,7 @@ const useModelState = ({ model, action, timeout, onNewState, map, mapWithCtx, in onNewStateThrottled.cancel(); core.off('NewState', onNewStateThrottled); }; - }, [routeFocused]); + }, [routeFocused, timeout, onNewState, map, mapWithCtx]); React.useLayoutEffect(() => { mountedRef.current = true; }, []);