Skip to content

Commit

Permalink
fix: 더보기 버튼 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
spearStr committed Dec 3, 2024
1 parent 933d109 commit 39c2b9c
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
14 changes: 9 additions & 5 deletions frontend/src/components/main/MainLiveSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ const MainLiveSection = ({ title }: MainLiveSectionProps) => {
const updateRenderCount = () => {
const width = window.innerWidth;

if (width <= 1095) setRenderCount(4);
else if (width <= 1434) setRenderCount(6);
else if (width <= 1770) setRenderCount(8);
else setRenderCount(10);
if (textStatus === VIDEO_VIEW.FOLD) {
setRenderCount(allData.length);
} else {
if (width <= 1095) setRenderCount(4);
else if (width <= 1434) setRenderCount(6);
else if (width <= 1770) setRenderCount(8);
else setRenderCount(10);
}
};

updateRenderCount();
Expand All @@ -36,7 +40,7 @@ const MainLiveSection = ({ title }: MainLiveSectionProps) => {
return () => {
window.removeEventListener('resize', updateRenderCount);
};
}, []);
}, [textStatus]);

Check warning on line 43 in frontend/src/components/main/MainLiveSection.tsx

View workflow job for this annotation

GitHub Actions / build (frontend)

React Hook useEffect has a missing dependency: 'allData.length'. Either include it or remove the dependency array

const handleTextChange = () => {
setTextStatus(textStatus === VIDEO_VIEW.MORE_VIEW ? VIDEO_VIEW.FOLD : VIDEO_VIEW.MORE_VIEW);
Expand Down
16 changes: 10 additions & 6 deletions frontend/src/components/main/MainReplaySection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,14 @@ const MainReplaySection = ({ title }: MainReplaySectionProps) => {
const updateRenderCount = () => {
const width = window.innerWidth;

if (width <= 1095) setRenderCount(4);
else if (width <= 1434) setRenderCount(6);
else if (width <= 1770) setRenderCount(8);
else setRenderCount(10);
if (textStatus === VIDEO_VIEW.FOLD) {
setRenderCount(allData.length);
} else {
if (width <= 1095) setRenderCount(4);
else if (width <= 1434) setRenderCount(6);
else if (width <= 1770) setRenderCount(8);
else setRenderCount(10);
}
};

updateRenderCount();
Expand All @@ -36,7 +40,7 @@ const MainReplaySection = ({ title }: MainReplaySectionProps) => {
return () => {
window.removeEventListener('resize', updateRenderCount);
};
}, []);
}, [textStatus]);

Check warning on line 43 in frontend/src/components/main/MainReplaySection.tsx

View workflow job for this annotation

GitHub Actions / build (frontend)

React Hook useEffect has a missing dependency: 'allData.length'. Either include it or remove the dependency array

const handleTextChange = () => {
setTextStatus(textStatus === VIDEO_VIEW.MORE_VIEW ? VIDEO_VIEW.FOLD : VIDEO_VIEW.MORE_VIEW);
Expand Down Expand Up @@ -91,4 +95,4 @@ const MainSectionContentList = styled.div<{ $textStatus: string }>`
> div {
max-width: 100%;
}
`;
`;

0 comments on commit 39c2b9c

Please sign in to comment.