Skip to content

Commit

Permalink
feat: make options to be initialized when parent options are set
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaeyeonAhn committed Dec 23, 2024
1 parent eca138f commit b19f2d0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/web/src/common/components/ThreeInput/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { useMemo } from "react";
import { useEffect, useMemo } from "react";
import styled from "styled-components";
import SemesterCard from "@sparcs-students/web/common/components/SelectCard/SemesterSelectCard";
import DocumentCard, {
Expand Down Expand Up @@ -96,6 +96,17 @@ const ThreeInput: React.FC<ThreeInputProps> = ({

const keyList = useMemo(() => totalList.map(e => e.key), [totalList]);

useEffect(() => {
setSelectedKey("");
setSelectedValue("");
}, [type, setSelectedKey, setSelectedValue]);

useEffect(() => {
if (documentTypes.length > 0) {
setType(documentTypes[0]);
}
}, [isSpring, documentTypes, setType]);

return (
<ThreeCardsWrapper>
<VerticalWrapper>
Expand Down

0 comments on commit b19f2d0

Please sign in to comment.