Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SP2] CI 에러 고치기, 리크루팅 탭 활동후기 복원 #268

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/views/BlogPage/hooks/useInfiniteScroll.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
import { useEffect } from 'react';
import { useEffect, useState } from 'react';
import { FetchNextPageOptions, InfiniteQueryObserverResult } from 'react-query';
import useBooleanState from '@src/hooks/useBooleanState';
import useIntersectionObserver from '@src/hooks/useIntersectionObserver';
import { BlogResponse } from '@src/lib/types/blog';

export default function useInfiniteScroll(fetchNextPage: {
(options?: FetchNextPageOptions): Promise<InfiniteQueryObserverResult<BlogResponse>>;
(): void;
}) {
const [hasObserved, setHasObserved, setHasUnObserved] = useBooleanState(false);
const [hasObserved, setHasObserved] = useState(false);

const ref = useIntersectionObserver(
async (entry, observer) => {
if (!hasObserved && entry.isIntersecting) {
fetchNextPage();
setHasObserved();
setHasObserved(true);
}

observer.unobserve(entry.target);
setHasUnObserved();
setHasObserved(false);
},
{ rootMargin: '80px' },
);

useEffect(() => {
setHasUnObserved();
setHasObserved(false);
}, []);

return { ref };
Expand Down
4 changes: 2 additions & 2 deletions src/views/RecruitPage/components/ActivityReview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default function ActivityReview() {
<ArrowLeft stroke={isLeftScrollable ? 'white' : 'grey'} />
</ArrowWrapper>
<Content ref={scrollableRef}>
{/* {reviews.data.map((review) => (
{reviews.data.map((review) => (
<Link
key={review.id}
href={review.url}
Expand All @@ -66,7 +66,7 @@ export default function ActivityReview() {
</DescWrapper>
</CardWrapper>
</Link>
))} */}
))}
</Content>
<ArrowWrapper onClick={() => onClickRightButton(scrollableRef.current)}>
<ArrowRight stroke={isRightScrollable ? 'white' : 'grey'} />
Expand Down
Loading