Skip to content

Commit

Permalink
Fix: #41 완료버튼 누르면 초기화되는 문제 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
eve712 committed Jun 24, 2021
1 parent 142e148 commit 9af8103
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions FE/issue-tracker/src/components/newIssue/SelectBox.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useEffect } from 'react';
import styled from 'styled-components';
import { useSetRecoilState } from 'recoil';
import { useSetRecoilState, useRecoilValue } from 'recoil';

import SelectAssignee from './select/SelectAssignee';
import SelectLabel from './select/SelectLabel';
Expand All @@ -9,15 +10,26 @@ import {
checkedLabelsAtom,
checkedMilestoneAtom,
} from '@store/atoms/checkedThings';
import { isClickedCompleteBtnAtom } from '@store/atoms/newIssue';

function SelectBox() {
const setCheckedAssignees = useSetRecoilState(checkedAssigneesAtom);
const setCheckedLabels = useSetRecoilState(checkedLabelsAtom);
const setCheckedMilestone = useSetRecoilState(checkedMilestoneAtom);
const isClickedCompleteBtn = useRecoilValue(isClickedCompleteBtnAtom);

setCheckedAssignees([]);
setCheckedLabels([]);
setCheckedMilestone(null);
useEffect(() => {
if (!isClickedCompleteBtn) {
setCheckedAssignees([]);
setCheckedLabels([]);
setCheckedMilestone(null);
}
}, [
isClickedCompleteBtn,
setCheckedAssignees,
setCheckedLabels,
setCheckedMilestone,
]);

return (
<SelectBoxWrap>
Expand Down

0 comments on commit 9af8103

Please sign in to comment.