Skip to content

Commit

Permalink
refactor: paint 전 단계에 스크롤 이동 하도록 개선
Browse files Browse the repository at this point in the history
노래 목록의 첫번째 요소의 player 로드가 되는 버그가 있었음.
첫번째 요소의 preview 이미지가 랜더된 후 스크롤 이동하기 때문에 발생한 문제.
paint 되기 전, 스크롤을 이동하도록 하여 수정
  • Loading branch information
Creative-Lee committed Sep 12, 2023
1 parent 5e4a5a6 commit ff8f27f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions frontend/src/pages/SongDetailListPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useRef } from 'react';
import { useEffect, useLayoutEffect, useRef } from 'react';
import { useParams } from 'react-router-dom';
import { styled } from 'styled-components';
import SongDetailItem from '@/features/songs/components/SongDetailItem';
Expand Down Expand Up @@ -64,7 +64,7 @@ const SongDetailListPage = () => {
return () => nextObserver.disconnect();
}, [fetchExtraNextSongDetails, songDetailEntries]);

useEffect(() => {
useLayoutEffect(() => {
itemRef.current?.scrollIntoView({ behavior: 'instant', block: 'start' });
}, [songDetailEntries]);

Expand Down

0 comments on commit ff8f27f

Please sign in to comment.