このコミットが含まれているのは:
2026-05-11 03:32:47 +09:00
コミット add60cb413
72個のファイルの変更1659行の追加247行の削除
+12 -5
ファイルの表示
@@ -9,7 +9,7 @@ import TagDetailSidebar from '@/components/TagDetailSidebar'
import MainArea from '@/components/layout/MainArea'
import SidebarComponent from '@/components/layout/SidebarComponent'
import { SITE_TITLE } from '@/config'
import { apiGet, apiPatch, apiPost, apiPut } from '@/lib/api'
import { apiGet, apiPatch, apiPost, apiPut, isApiError } from '@/lib/api'
import { fetchPost } from '@/lib/posts'
import { dateString } from '@/lib/utils'
@@ -34,11 +34,12 @@ const INITIAL_THEATRE_INFO =
watchingUsers: [] as { id: number; name: string }[] } as const
export default (() => {
const TheatreDetailPage: FC = () => {
const { id } = useParams ()
const commentsRef = useRef<HTMLDivElement> (null)
const embedRef = useRef<NiconicoViewerHandle> (null)
const loadingRef = useRef (false)
const theatreInfoRef = useRef<TheatreInfo> (INITIAL_THEATRE_INFO)
const videoLengthRef = useRef (0)
const lastCommentNoRef = useRef (0)
@@ -53,6 +54,10 @@ export default (() => {
const [post, setPost] = useState<Post | null> (null)
const [videoLength, setVideoLength] = useState (0)
useEffect (() => {
loadingRef.current = loading
}, [loading])
useEffect (() => {
theatreInfoRef.current = theatreInfo
}, [theatreInfo])
@@ -87,7 +92,7 @@ export default (() => {
}
catch (error)
{
setStatus ((error as any)?.response.status ?? 200)
setStatus (isApiError (error) ? error.response?.status ?? 200 : 200)
}
}) ()
@@ -160,7 +165,7 @@ export default (() => {
}, [id])
useEffect (() => {
if (!(id) || !(theatreInfo.hostFlg) || loading || theatreInfo.postId != null)
if (!(id) || !(theatreInfo.hostFlg) || loadingRef.current || theatreInfo.postId != null)
return
let cancelled = false
@@ -338,4 +343,6 @@ export default (() => {
{post && <TagDetailSidebar post={post} sp/>}
</div>
</div>)
}) satisfies FC
}
export default TheatreDetailPage