diff --git a/src/components/MetaPreview/MetaPreview.js b/src/components/MetaPreview/MetaPreview.js
index e4bc6448b..e50d6c604 100644
--- a/src/components/MetaPreview/MetaPreview.js
+++ b/src/components/MetaPreview/MetaPreview.js
@@ -99,7 +99,7 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
const renderLogoFallback = React.useCallback(() => (
{name}
), [name]);
- const libAndWatchedGroup = React.useMemo(() => [
+ const metaItemActions = React.useMemo(() => [
{
icon: inLibrary ? 'remove-from-library' : 'add-to-library',
label: inLibrary ? t('REMOVE_FROM_LIB') : t('ADD_TO_LIB'),
@@ -223,7 +223,7 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
}
{
typeof toggleInLibrary === 'function' && typeof toggleWatched === 'function'
- ?
+ ?
: null
}
{
@@ -239,9 +239,13 @@ const MetaPreview = React.forwardRef(({ className, compact, name, logo, backgrou
null
}
{
- !compact && ratingInfo !== null
- ?
- : null
+ !compact && ratingInfo !== null ?
+
+ :
+ null
}
{
linksGroups.has(CONSTANTS.SHARE_LINK_CATEGORY) && !compact ?
diff --git a/src/routes/Discover/Discover.js b/src/routes/Discover/Discover.js
index 6675d6d30..be28eeafd 100644
--- a/src/routes/Discover/Discover.js
+++ b/src/routes/Discover/Discover.js
@@ -74,17 +74,17 @@ const Discover = ({ urlParams, queryParams }) => {
}
});
}, [selectedMetaItem]);
- const toggleWatched = React.useCallback((item) => {
- if (item === null) {
+ const toggleWatched = React.useCallback(() => {
+ if (selectedMetaItem === null) {
return;
}
- if (!item.inLibrary) {
+ if (!selectedMetaItem.inLibrary) {
core.transport.dispatch({
action: 'Ctx',
args: {
action: 'AddToLibrary',
- args: item
+ args: selectedMetaItem
}
});
}
@@ -94,12 +94,12 @@ const Discover = ({ urlParams, queryParams }) => {
args: {
action: 'LibraryItemMarkAsWatched',
args: {
- id: item.id,
- is_watched: !item.watched
+ id: selectedMetaItem.id,
+ is_watched: !selectedMetaItem.watched
}
}
});
- }, []);
+ }, [selectedMetaItem]);
const metaItemsOnFocusCapture = React.useCallback((event) => {
if (event.target.dataset.index !== null && !isNaN(event.target.dataset.index)) {
setSelectedMetaItemIndex(parseInt(event.target.dataset.index, 10));
@@ -220,7 +220,7 @@ const Discover = ({ urlParams, queryParams }) => {
inLibrary={selectedMetaItem.inLibrary}
toggleInLibrary={selectedMetaItem.inLibrary ? removeFromLibrary : addToLibrary}
watched={selectedMetaItem.watched}
- toggleWatched={() => toggleWatched(selectedMetaItem)}
+ toggleWatched={toggleWatched}
metaId={selectedMetaItem.id}
like={selectedMetaItem.like}
/>