Skip to content

Commit

Permalink
Fix unwented parent level closing
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpro committed Jun 18, 2022
1 parent 1ff447c commit fac8443
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions front/src/features/notice/Notice.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export function Notice() {
const [submittedNotice, setSubmittedNotice] = useState({title: ''});
const [suggestionId, setSuggestionId] = useState(undefined);
const [pollingFlag, setPollingFlag] = useState(false);
const [domainUpdateFlag, setDomainUpdateFlag] = useState(false);
const [levelUpdateFlag, setLevelUpdateFlag] = useState(false);

const initiallyExcludedValues = {};

Expand Down Expand Up @@ -141,7 +143,7 @@ export function Notice() {
}}

/>
}, [vocabularies, notice])
}, [vocabularies, domainUpdateFlag])

const levelsTree = useMemo(() => {
return <DropdownTreeSelect
Expand All @@ -164,7 +166,7 @@ export function Notice() {
}}

/>
}, [vocabularies, notice])
}, [vocabularies, levelUpdateFlag])

const statusText = useMemo(() => {
const running = currentSuggestion?.status === 'running'
Expand Down Expand Up @@ -260,7 +262,10 @@ export function Notice() {
suggestions={currentSuggestion.suggestions?.domain?.filter((x) => x !== notice.domain && !isValueSelected('domain', x))}
titleProvider={id => getVocabularyTerms('15GTPX-flat')[id]}
rejectCallback={(value) => dispatchExcludedValues({field: 'domain', value: value})}
acceptCallback={(values) => handleUserSelectionChange({domain: (notice.domain || []).concat(values)})}
acceptCallback={(values) => {
handleUserSelectionChange({domain: (notice.domain || []).concat(values)});
setDomainUpdateFlag(true);
}}
/>}</Grid>
<Grid item>{domainsTree}</Grid>
</Grid>
Expand All @@ -276,7 +281,10 @@ export function Notice() {
suggestions={currentSuggestion.suggestions?.level?.filter((x) => x !== notice.domain && !isValueSelected('level', x))}
titleProvider={id => getVocabularyTerms('22-flat')[id]}
rejectCallback={(value) => dispatchExcludedValues({field: 'level', value: value})}
acceptCallback={(values) => handleUserSelectionChange({level: (notice.level || []).concat(values)})}
acceptCallback={(values) => {
handleUserSelectionChange({level: (notice.level || []).concat(values)});
setLevelUpdateFlag(true);
}}
/>}</Grid>
<Grid item>{levelsTree}</Grid>
</Grid>
Expand Down

0 comments on commit fac8443

Please sign in to comment.