Skip to content

Commit

Permalink
[Remove] 사용하지 않는 변수 로그 삭제 #33
Browse files Browse the repository at this point in the history
why 가독성을 해침
사용하지 않는 부분 삭제
  • Loading branch information
WooYeonSeo committed Nov 28, 2019
1 parent ee18f00 commit 909b4da
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions client/src/composition/Feed/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ const FeedList = () => {
const [isLoading, setIsLoading] = useState<boolean>(false);
const [isEnd, setIsEnd] = useState<boolean>(false);

const [ref, setRef] = useIntersect(checkIsEnd, {});
const [_, setRef] = useIntersect(checkIsEnd, {});

// hooks 에서 useQuery 1 부터 시작
const { loading, data, fetchMore } = useQuery<Feeds, FeedVars>(GET_FEEDS, {
const { fetchMore } = useQuery<Feeds, FeedVars>(GET_FEEDS, {
variables: { first: OFFSET, currentCursor: cursor }
});

Expand All @@ -86,19 +86,12 @@ const FeedList = () => {
if (!fetchMoreResult) {
return prev;
}
console.log('cursor ', cursor);
if (!fetchMoreResult.feedItems.length) {
setIsEnd(true);
return prev;
}

const { feedItems } = fetchMoreResult;
const lastFeedItem = feedItems[feedItems.length - 1];
console.log(
'lastFeedItem ',
getDate(lastFeedItem.feed.createdAt).toISOString()
);

setCursor(getDate(lastFeedItem.feed.createdAt).toISOString());

return Object.assign({}, prev, {
Expand Down Expand Up @@ -128,9 +121,7 @@ const FeedList = () => {
createdAt={getDate(feed.feed.createdAt).toISOString()}
/>
))}
<LoadCheckContainer
onClick={fetchMoreFeed}
ref={setRef as any}></LoadCheckContainer>
<LoadCheckContainer onClick={fetchMoreFeed} ref={setRef as any} />
<div onClick={fetchMoreFeed}>
{isLoading ? 'LOADING' : ''}
{isEnd ? '마지막 글입니다' : ''}
Expand Down

0 comments on commit 909b4da

Please sign in to comment.