mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-05-06 07:39:05 +00:00
refactor: simplify handling on the libitem
This commit is contained in:
parent
e26c33fe33
commit
68c0a4fb13
1 changed files with 7 additions and 4 deletions
|
|
@ -119,11 +119,14 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
|
|||
}
|
||||
}, [_id, props.deepLinks, props.optionOnSelect]);
|
||||
|
||||
const onPlayClick = React.useCallback((event) => {
|
||||
const onPlayClick = React.useMemo(() => {
|
||||
if (props.deepLinks && typeof props.deepLinks.player === 'string') {
|
||||
event.preventDefault();
|
||||
window.location = props.deepLinks.player;
|
||||
return (event) => {
|
||||
event.preventDefault();
|
||||
window.location = props.deepLinks.player;
|
||||
};
|
||||
}
|
||||
return null;
|
||||
}, [props.deepLinks]);
|
||||
|
||||
return (
|
||||
|
|
@ -133,7 +136,7 @@ const LibItem = ({ _id, removable, notifications, watched, ...props }) => {
|
|||
newVideos={newVideos}
|
||||
options={options}
|
||||
optionOnSelect={optionOnSelect}
|
||||
onPlayClick={props.deepLinks && typeof props.deepLinks.player === 'string' ? onPlayClick : null}
|
||||
onPlayClick={onPlayClick}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue