Skip to content

Commit

Permalink
fix: optimize rendering - home study section (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
SeungJL authored May 19, 2024
2 parents 948dc73 + 1ab7edd commit aec5d4a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pageTemplates/home/HomeStudySection.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dayjs from "dayjs";
import { AnimatePresence, motion, PanInfo } from "framer-motion";
import { useRouter, useSearchParams } from "next/navigation";
import { useSession } from "next-auth/react";
import { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";
import { useRecoilValue, useSetRecoilState } from "recoil";
import styled from "styled-components";
Expand Down Expand Up @@ -51,8 +51,11 @@ export default function HomeStudySection() {
const { mutate: decideStudyResult } = useStudyResultDecideMutation(date);

useEffect(() => {
if (!studyVoteData || !studyVoteData.length || !session?.user) return;

if (!studyVoteData || !studyVoteData.length || !session?.user || !studyDateStatus) {
setStudyCardColData(null);
return;
}
console.log(1, studyVoteData, studyDateStatus);
const sortedData = sortStudyVoteData(studyVoteData, studyDateStatus !== "not passed");

const cardList = setStudyDataToCardCol(sortedData, date as string, session?.user.uid);
Expand Down

0 comments on commit aec5d4a

Please sign in to comment.