Skip to content

Commit

Permalink
fix: prevRecoil 초기화로 visit 방문 시 prev 버튼 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
esthel7 committed Jan 23, 2024
1 parent e4711fe commit ba9f1b6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions front/src/pages/Visit/Deco/DecoEnroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NavigateFunction, useNavigate, useParams } from 'react-router-dom';
import { useResetRecoilState } from 'recoil';
import styled from 'styled-components';
import { BlurBody, theme } from '@utils';
import { VisitDecoRecoil } from '@states';
import { PrevRecoil, VisitDecoRecoil } from '@states';

interface NaviProps {
visible: [number, React.Dispatch<React.SetStateAction<number>>];
Expand Down Expand Up @@ -101,7 +101,9 @@ const DecoEnroll = (props: NaviProps) => {
const { user } = useParams();
const [isFocus, setIsFocus] = useState(true);
const closeRef = useRef<HTMLDivElement>(null);
const resetPrev = useResetRecoilState(PrevRecoil);
const resetVisitDeco = useResetRecoilState(VisitDecoRecoil);

return (
<>
<BlurBody
Expand All @@ -123,7 +125,7 @@ const DecoEnroll = (props: NaviProps) => {
<ButtonWrap>
<StyledNavButton
color={theme.colors['--primary-red-primary']}
onClick={() =>
onClick={() => {
CloseNav(
props,
closeRef,
Expand All @@ -132,8 +134,9 @@ const DecoEnroll = (props: NaviProps) => {
user,
'root',
resetVisitDeco
)
}
);
resetPrev();
}}
>
<StyeldButtonText>
<StyledImgIcon
Expand All @@ -149,7 +152,7 @@ const DecoEnroll = (props: NaviProps) => {
<ButtonWrap>
<StyledNavButton
color={theme.colors['--primary-green-primary']}
onClick={() =>
onClick={() => {
CloseNav(
props,
closeRef,
Expand All @@ -158,8 +161,9 @@ const DecoEnroll = (props: NaviProps) => {
user,
'close',
resetVisitDeco
)
}
);
resetPrev();
}}
>
<StyeldButtonText>전송한 선물 확인하기</StyeldButtonText>
</StyledNavButton>
Expand Down

0 comments on commit ba9f1b6

Please sign in to comment.