Fixed destructuring null statistics for bulk delete movies modal

This commit is contained in:
Bogdan 2024-07-05 13:20:09 +03:00
parent 10bb270da8
commit 4cec41324b
1 changed files with 6 additions and 7 deletions

View File

@ -88,8 +88,7 @@ function DeleteMovieModalContent(props: DeleteMovieModalContentProps) {
const { totalMovieFileCount, totalSizeOnDisk } = useMemo(() => { const { totalMovieFileCount, totalSizeOnDisk } = useMemo(() => {
return movies.reduce( return movies.reduce(
(acc, m) => { (acc, { statistics = {} }) => {
const { statistics = { movieFileCount: 0, sizeOnDisk: 0 } } = m;
const { movieFileCount = 0, sizeOnDisk = 0 } = statistics; const { movieFileCount = 0, sizeOnDisk = 0 } = statistics;
acc.totalMovieFileCount += movieFileCount; acc.totalMovieFileCount += movieFileCount;
@ -159,17 +158,17 @@ function DeleteMovieModalContent(props: DeleteMovieModalContentProps) {
</div> </div>
<ul> <ul>
{movies.map((m) => { {movies.map(({ title, path, statistics = {} }) => {
const { movieFileCount = 0, sizeOnDisk = 0 } = m.statistics; const { movieFileCount = 0, sizeOnDisk = 0 } = statistics;
return ( return (
<li key={m.title}> <li key={title}>
<span>{m.title}</span> <span>{title}</span>
{deleteFiles && ( {deleteFiles && (
<span> <span>
<span className={styles.pathContainer}> <span className={styles.pathContainer}>
-<span className={styles.path}>{m.path}</span> -<span className={styles.path}>{path}</span>
</span> </span>
{!!movieFileCount && ( {!!movieFileCount && (