diff --git a/src/components/shared/AddIngredientsToMyTteokgukModal.tsx b/src/components/shared/AddIngredientsToMyTteokgukModal.tsx index f1f11d7..d5dee49 100644 --- a/src/components/shared/AddIngredientsToMyTteokgukModal.tsx +++ b/src/components/shared/AddIngredientsToMyTteokgukModal.tsx @@ -92,7 +92,11 @@ const AddIngredientsToMyTteokgukModal = ({ ), )} - diff --git a/src/components/shared/SendIngredientToOthersTteokgukModal.tsx b/src/components/shared/SendIngredientToOthersTteokgukModal.tsx index 965584d..9008e56 100644 --- a/src/components/shared/SendIngredientToOthersTteokgukModal.tsx +++ b/src/components/shared/SendIngredientToOthersTteokgukModal.tsx @@ -13,6 +13,7 @@ import Button from "../common/Button"; import CreateCheerMessageModal from "./CreateCheerMessageModal"; import { $updateSelectedIngredient } from "@/store/ingredient"; +import { useEffect } from "react"; interface Props { isOpen: boolean; @@ -45,6 +46,7 @@ const SendIngredientsToOthersTteokgukModal = ({ { + updateSelectedIngredient(null); handleCloseCheerMessageModal(); onClose(); }} @@ -58,6 +60,12 @@ const SendIngredientsToOthersTteokgukModal = ({ onClose(); }; + useEffect(() => { + return () => { + updateSelectedIngredient(null); + }; + }, [updateSelectedIngredient]); + return ( isOpen && ( @@ -81,7 +89,12 @@ const SendIngredientsToOthersTteokgukModal = ({ ), )} -