diff --git a/src/renderer/components/item-list/item-table-list/columns/favorite-column.tsx b/src/renderer/components/item-list/item-table-list/columns/favorite-column.tsx index af4ddac45..23767788f 100644 --- a/src/renderer/components/item-list/item-table-list/columns/favorite-column.tsx +++ b/src/renderer/components/item-list/item-table-list/columns/favorite-column.tsx @@ -27,21 +27,27 @@ export const FavoriteColumn = (props: ItemTableListInnerColumn) => { size: 'md', }} onClick={() => { + if (!props.data?.[props.rowIndex]) { + return; + } + if (row) { deleteFavorite.mutate({ query: { - id: [(props.data as any)?.[props.rowIndex]?.id as string], - type: (props.data as any)?.[props.rowIndex] - ?.itemType as LibraryItem, + id: [(props.data as any)[props.rowIndex].id as string], + type: (props.data as any)[props.rowIndex] + .itemType as LibraryItem, }, + serverId: (props.data as any)[props.rowIndex].serverId as string, }); } else { createFavorite.mutate({ query: { - id: [(props.data as any)?.[props.rowIndex]?.id as string], - type: (props.data as any)?.[props.rowIndex] - ?.itemType as LibraryItem, + id: [(props.data as any)[props.rowIndex].id as string], + type: (props.data as any)[props.rowIndex] + .itemType as LibraryItem, }, + serverId: (props.data as any)[props.rowIndex].serverId as string, }); } }}