mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
handle prop change in useModelState
This commit is contained in:
parent
d2af3c6a91
commit
08dd4bdbb7
1 changed files with 2 additions and 2 deletions
|
|
@ -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;
|
||||
}, []);
|
||||
|
|
|
|||
Loading…
Reference in a new issue