[SHOPTIME-3412] Full Player / Live / Live Channel / 다른 방송을 연속으로 계속 클릭 할 경우 잠시 멈춤 현상

[원인] showId가 같다면 클릭을 하지 않는 로직이 존재하지만 티비로 테스트시 속도 문제로 해당 로직이 정상적인 타이밍에 읽지않는것으로 판단

[대책] 중복으로 클릭이 안되도록 setTimeout을 이용해 로직 추가
This commit is contained in:
고동영
2024-12-26 15:51:55 +09:00
parent 6ae6ab7cf1
commit f4f61885e6
2 changed files with 33 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useMemo } from "react"; import React, { useCallback, useEffect, useMemo, useRef } from "react";
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
@@ -25,7 +25,7 @@ export default function FeaturedShowContents({
handleItemFocus, handleItemFocus,
}) { }) {
const dispatch = useDispatch(); const dispatch = useDispatch();
const isClickBlocked = useRef(false);
const handleFocus = useCallback( const handleFocus = useCallback(
() => () => { () => () => {
if (handleItemFocus) { if (handleItemFocus) {
@@ -49,6 +49,16 @@ export default function FeaturedShowContents({
} = featuredShowsInfos[index]; } = featuredShowsInfos[index];
const handleItemClick = () => { const handleItemClick = () => {
//중복클릭방지
if (isClickBlocked.current) {
return;
}
isClickBlocked.current = true;
setTimeout(() => {
isClickBlocked.current = false;
}, 600);
if (currentVideoShowId && currentVideoShowId === showId) { if (currentVideoShowId && currentVideoShowId === showId) {
return; return;
} }
@@ -93,6 +103,7 @@ export default function FeaturedShowContents({
currentVideoInfo, currentVideoInfo,
currentVideoShowId, currentVideoShowId,
videoVerticalVisible, videoVerticalVisible,
isClickBlocked,
] ]
); );

View File

@@ -1,4 +1,4 @@
import React, { useCallback, useEffect, useState } from "react"; import React, { useCallback, useEffect, useRef, useState } from "react";
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
@@ -22,7 +22,7 @@ export default function LiveChannelContents({
handleItemFocus, handleItemFocus,
}) { }) {
const dispatch = useDispatch(); const dispatch = useDispatch();
const isClickBlocked = useRef(false);
const handleFocus = useCallback( const handleFocus = useCallback(
() => () => { () => () => {
if (handleItemFocus) { if (handleItemFocus) {
@@ -51,6 +51,16 @@ export default function LiveChannelContents({
} = liveInfos[index]; } = liveInfos[index];
const handleItemClick = () => { const handleItemClick = () => {
//중복클릭방지
if (isClickBlocked.current) {
return;
}
isClickBlocked.current = true;
setTimeout(() => {
isClickBlocked.current = false;
}, 600);
if (!showId) return; if (!showId) return;
if (currentVideoShowId && currentVideoShowId === showId) { if (currentVideoShowId && currentVideoShowId === showId) {
@@ -100,7 +110,14 @@ export default function LiveChannelContents({
/> />
); );
}, },
[liveInfos, currentTime, currentVideoShowId, dispatch, handleFocus] [
liveInfos,
currentTime,
currentVideoShowId,
isClickBlocked,
dispatch,
handleFocus,
]
); );
return ( return (