Skip to content

Commit

Permalink
[NO-ISSUE] Fix: $selectedIngredient 초기화 잘 되도록 수정 (#145)
Browse files Browse the repository at this point in the history
minsour authored Feb 9, 2024
1 parent 725aaca commit ca741f0
Showing 2 changed files with 19 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/components/shared/AddIngredientsToMyTteokgukModal.tsx
Original file line number Diff line number Diff line change
@@ -92,7 +92,11 @@ const AddIngredientsToMyTteokgukModal = ({
),
)}
</ol>
<Button color="primary.100" applyColorTo="background">
<Button
disabled={selectedIngredients.length === 0}
color="primary.100"
applyColorTo="background"
>
추가하기
</Button>
</form>
15 changes: 14 additions & 1 deletion src/components/shared/SendIngredientToOthersTteokgukModal.tsx
Original file line number Diff line number Diff line change
@@ -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 = ({
<CreateCheerMessageModal
isOpen={isOpen}
onClose={() => {
updateSelectedIngredient(null);
handleCloseCheerMessageModal();
onClose();
}}
@@ -58,6 +60,12 @@ const SendIngredientsToOthersTteokgukModal = ({
onClose();
};

useEffect(() => {
return () => {
updateSelectedIngredient(null);
};
}, [updateSelectedIngredient]);

return (
isOpen && (
<Modal className={styles.container}>
@@ -81,7 +89,12 @@ const SendIngredientsToOthersTteokgukModal = ({
),
)}
</ol>
<Button onClick={handleClickNextButton} color="primary.100" applyColorTo="background">
<Button
disabled={!selectedIngredient}
onClick={handleClickNextButton}
color="primary.100"
applyColorTo="background"
>
다음
</Button>
</Modal.Body>

0 comments on commit ca741f0

Please sign in to comment.