Skip to content

Commit

Permalink
fix: 로그인 직후 내가 작성한 피드 갱신 오류 수정 (#135)
Browse files Browse the repository at this point in the history
ideas는 변경되지 않았으므로 refetch를 수행하지 않는다. 아이디어카드 섹션 컴포넌트 내부에 클로저 형태로 존재하던 nickname 값을 컴포넌트 내 변수로 변경한다.
  • Loading branch information
semnil5202 authored Apr 27, 2024
1 parent a7b574e commit 11ad42e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ import { useIdeasQuery } from '../../hooks/queries/useIdeasQuery';
import { useFeedInfiniteFetch } from '../../hooks/useFeedInfiniteFetch';
import { getUserNickname } from '../../utils/getUserNickname';

const nickname = getUserNickname();

const CardList = () => {
const { filterParams } = useFilterParams();
const { ideas, fetchNextPage } = useIdeasQuery(filterParams);
const { goProfilePage } = useNavigatePage();
const { deleteIdea } = useDeleteIdea();
const openConfirm = useConfirm();
const nickname = getUserNickname();

const intersectionRef = useRef(null);

Expand Down
6 changes: 1 addition & 5 deletions src/pages/Login/KakaoRedirect.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { useQueryClient } from '@tanstack/react-query';
import { useCallback, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';

Expand All @@ -7,7 +6,6 @@ import Spinner from '../../components/Spinner/Spinner';

const KakaoRedirect = () => {
const navigate = useNavigate();
const queryClient = useQueryClient();
const searchParams = new URLSearchParams(location.search);
const code = searchParams.get('code');

Expand All @@ -22,15 +20,13 @@ const KakaoRedirect = () => {
localStorage.setItem('userToken', accessToken);
localStorage.setItem('user', JSON.stringify(authMemberInformation));

await queryClient.refetchQueries({ queryKey: ['ideas'] });

navigate('/');
return;
}

navigate('/agreement', { state: data.oauthMemberInformation });
},
[navigate, queryClient],
[navigate],
);

useEffect(() => {
Expand Down

0 comments on commit 11ad42e

Please sign in to comment.