Skip to content

Commit

Permalink
[๐Ÿ›  : fix] ํ”„๋กœํ•„ ์ˆ˜์ •์‹œ ๋ฆฌ๋ Œ๋”๋ง ์ ์šฉ (#2)
Browse files Browse the repository at this point in the history
- useEffect์˜ dependency๋กœ ์œ ์ € ๋ฐ์ดํ„ฐ๋ฅผ ๋„ฃ์–ด ์ƒํƒœ ๋ณ€ํ™”์™€ ๋™์‹œ์— ๋ฆฌ๋ Œ๋”๋งํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•จ
- ์ด์ „์— ๋ฆฌ๋ Œ๋”๋ง ์ ์šฉํ–ˆ์—ˆ์œผ๋‚˜ ํ”„๋กœํ•„ ํ™•์žฅ ์ž‘์—… ์ค‘ ๋ˆ„๋ฝ๋œ ๊ฒƒ์œผ๋กœ ์ถ”์ •
  • Loading branch information
sryung1225 committed Jan 10, 2024
1 parent 0ee2623 commit e33e4bd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/routes/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { useEffect, useState } from 'react';
import { useLocation } from 'react-router-dom';
import { useRecoilValue } from 'recoil';
import { collection, getDocs, query, where } from 'firebase/firestore';
import { db } from '@/firebase.ts';
import WindowTop from '@compo/window-top.tsx';
import UserProfile from '@compo/profile/user-profile.tsx';
import UserTimeline from '@compo/profile/user-timeline.tsx';
import * as W from '@style/window.ts';
import { collection, getDocs, query, where } from 'firebase/firestore';
import { db } from '@/firebase.ts';
import currentUserAtom from '@atom/current-user.tsx';
import IUser from '@type/IUser.ts';
import * as W from '@style/window.ts';

export default function Profile() {
const location = useLocation();
const userFromLocation = location.search.slice(7);
const [user, setUser] = useState<IUser | undefined>();
const currentUser = useRecoilValue(currentUserAtom);
useEffect(() => {
const fetchUser = async () => {
const usersQuery = query(
Expand All @@ -27,7 +30,7 @@ export default function Profile() {
}
};
fetchUser();
}, [userFromLocation]);
}, [userFromLocation, currentUser]);
return (
<W.Window>
<WindowTop />
Expand Down

0 comments on commit e33e4bd

Please sign in to comment.