Skip to content

Commit

Permalink
친구 페이지 리페치 조건 수정
Browse files Browse the repository at this point in the history
transitionState가 꼭 페이지 전환 떄마다 바뀌는 것은 아니었음
  • Loading branch information
happyGyu committed Oct 2, 2024
1 parent 6fd23e8 commit 48f1860
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/pages/friend/Main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,19 @@ import {
import { Link } from "@/stackflow/Link";
import { getRandomItems } from "@/utils/getRandomItems";
import { AppScreen } from "@stackflow/plugin-basic-ui";
import { type ActivityComponentType, useActivity } from "@stackflow/react";
import type { ActivityComponentType } from "@stackflow/react";
import { useEffect } from "react";
import { SearchInput } from "../SearchInput";

export const FriendMainPage: ActivityComponentType = () => {
const { transitionState } = useActivity();
const { data: recommendFriendRes, refetch: refetchRecommendFriends } =
useGetRecommendFriends();
const { data: friendRes, refetch: refectchFriends } = useGetFriends();

useEffect(() => {
if (transitionState === "enter-active") {
refetchRecommendFriends();
refectchFriends();
}
}, [transitionState, refectchFriends, refetchRecommendFriends]);
refetchRecommendFriends();
refectchFriends();
}, [window.location.pathname, refectchFriends, refetchRecommendFriends]);

return (
<AppScreen>
Expand Down

0 comments on commit 48f1860

Please sign in to comment.