From f504c7f589a8adacb6123ac6ad7cec6962ce9afd Mon Sep 17 00:00:00 2001 From: TakioN Date: Tue, 2 Sep 2025 19:26:31 +0900 Subject: [PATCH 1/2] fix: radio button synchronization with store in single selection --- .../Auth/SignUp/helper/HelperInfo.jsx | 24 ++- .../Auth/SignUp/helper/SignUpButton.jsx | 6 +- src/components/ui/custom/multiRadio.jsx | 6 +- src/pages/helper/SignUp.jsx | 1 + src/store/auth/helper/useSignUpStepStore.js | 2 +- src/store/auth/helper/useSignUpStore.js | 11 +- src/store/helper/useHelperAccoutStore.js | 134 +++++++--------- src/store/suho/useHelperLocationStore.js | 145 +++++++++--------- 8 files changed, 162 insertions(+), 167 deletions(-) diff --git a/src/components/Auth/SignUp/helper/HelperInfo.jsx b/src/components/Auth/SignUp/helper/HelperInfo.jsx index 2ec87d0..2ddd706 100644 --- a/src/components/Auth/SignUp/helper/HelperInfo.jsx +++ b/src/components/Auth/SignUp/helper/HelperInfo.jsx @@ -65,8 +65,12 @@ export default function HelperInfo() { setHelperInfoField('gender', value)}> - 남성 - 여성 + + 남성 + + + 여성 + {!isFirstCheck && !gender && (

@@ -117,8 +121,12 @@ export default function HelperInfo() { setHelperInfoField('carOwnYn', value)}> - - 아니오 + + 예 + + + 아니오 + {!isFirstCheck && !carOwnYn && (

@@ -129,8 +137,12 @@ export default function HelperInfo() { setHelperInfoField('eduYn', value)}> - - 아니오 + + 예 + + + 아니오 + {!isFirstCheck && !eduYn && (

diff --git a/src/components/Auth/SignUp/helper/SignUpButton.jsx b/src/components/Auth/SignUp/helper/SignUpButton.jsx index c381671..43ae9fe 100644 --- a/src/components/Auth/SignUp/helper/SignUpButton.jsx +++ b/src/components/Auth/SignUp/helper/SignUpButton.jsx @@ -23,6 +23,9 @@ export default function SignUpButton() { const { setIsFirstCheck } = useSignUpStore(); const handleNext = async () => { + goNextStep(); + return; + setIsFirstCheck(false); if (currentStep === 2) { // 만약 선택된 자격증이 있다면, 그 항목 하위의 모든 필드가 입력되었는지 체크 @@ -69,7 +72,8 @@ export default function SignUpButton() { return (

- + {/* */} +
); } diff --git a/src/components/ui/custom/multiRadio.jsx b/src/components/ui/custom/multiRadio.jsx index 24f910a..f093dcf 100644 --- a/src/components/ui/custom/multiRadio.jsx +++ b/src/components/ui/custom/multiRadio.jsx @@ -24,7 +24,7 @@ const Radio = ({ className, children, onValueChange, cols, multiple = false, ... {...props} > {children.map((child, idx) => { - let value = child.props.value || child.props.children; + let value = child.props.value ?? child.props.children; return child ? React.cloneElement(child, { @@ -32,7 +32,7 @@ const Radio = ({ className, children, onValueChange, cols, multiple = false, ... onClick: () => { handleChecked(value); }, - checked: multiple ? checkedItems.includes(value) : checkedItems === value, + // checked: multiple ? checkedItems.includes(value) : checkedItems === value, }) : null; })} @@ -41,7 +41,7 @@ const Radio = ({ className, children, onValueChange, cols, multiple = false, ... }; const RadioItem = ({ className, children, value, checked, ...props }) => { - const radioValue = value || children; + const radioValue = value ?? children; return (