Fix an issue that cause subtitles missing in movie page

This commit is contained in:
LASER-Yi 2021-05-09 11:42:21 +08:00
parent a417f35856
commit b4037442b1
2 changed files with 9 additions and 2 deletions

View File

@ -11,7 +11,7 @@ import React, { FunctionComponent, useCallback, useState } from "react";
import { Container, Row } from "react-bootstrap";
import { Helmet } from "react-helmet";
import { Redirect, RouteComponentProps, withRouter } from "react-router-dom";
import { useMovieBy } from "../../@redux/hooks";
import { useMovieBy, useProfileBy } from "../../@redux/hooks";
import { MoviesApi, ProvidersApi } from "../../apis";
import {
ContentHeader,
@ -51,6 +51,8 @@ const MovieDetailView: FunctionComponent<Props> = ({ match }) => {
const [movie] = useMovieBy(id);
const item = movie.data;
const profile = useProfileBy(movie.data?.profileId);
const showModal = useShowModal();
const [valid, setValid] = useState(true);
@ -141,7 +143,7 @@ const MovieDetailView: FunctionComponent<Props> = ({ match }) => {
<ItemOverview item={item} details={[]}></ItemOverview>
</Row>
<Row>
<Table movie={item}></Table>
<Table movie={item} profile={profile}></Table>
</Row>
<ItemEditorModal
modalKey="edit"

View File

@ -107,6 +107,9 @@ const Table: FunctionComponent<Props> = ({ movie, profile }) => {
return item;
});
console.log(movie.subtitles);
console.log(profileItems);
let raw_subtitles = movie.subtitles;
if (onlyDesired) {
raw_subtitles = intersectionWith(
@ -116,6 +119,8 @@ const Table: FunctionComponent<Props> = ({ movie, profile }) => {
);
}
console.log(raw_subtitles);
return [...raw_subtitles, ...missing];
}, [movie.missing_subtitles, movie.subtitles, onlyDesired, profileItems]);