Skip to content

Commit

Permalink
feat: fix selection (1) - Ref gestion-de-projet#1603
Browse files Browse the repository at this point in the history
  • Loading branch information
mourads committed May 24, 2023
1 parent 5e862e7 commit d46877f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ const PopulationCard: React.FC<populationCardPropsType> = (props) => {

const _onSubmit = async (updatedSelection: ScopeTreeRow[] | null) => {
if (updatedSelection === null && !executiveUnits) return
updatedSelection = filterScopeTree(updatedSelection ?? [])
updatedSelection = updatedSelection.map((selectedPopulations: ScopeTreeRow) => ({
updatedSelection = (updatedSelection ?? []).map((selectedPopulations: ScopeTreeRow) => ({
...selectedPopulations,
subItems: []
}))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ const PopulationRightPanel: React.FC<PopulationRightPanelProps> = (props) => {
const [_selectedPopulation, _setSelectedPopulation] = useState<ScopeTreeRow[]>(selectedPopulation)
const [searchInput, setSearchInput] = useState('')

// useEffect(() => {
// _setSelectedPopulation(
// selectedPopulation !== null ? (selectedPopulation?.filter((elem) => elem !== undefined) as ScopeTreeRow[]) : []
// )
// }, [open]) // eslint-disable-line

/**
* Render
*/
Expand Down
5 changes: 1 addition & 4 deletions src/views/Scope/Scope.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react'
import React, { useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import clsx from 'clsx'

Expand All @@ -12,7 +12,6 @@ import ScopeSearchBar from 'components/Inputs/ScopeSearchBar/ScopeSearchBar'

import { useAppDispatch, useAppSelector } from 'state'
import { closeAllOpenedPopulation } from 'state/scope'
import { filterScopeTree } from 'utils/scopeTree'

import useStyles from './styles'

Expand All @@ -35,8 +34,6 @@ const Scope = () => {
const trimItems = () => {
let _selectedItems = selectedItems ? selectedItems : []

_selectedItems = filterScopeTree(_selectedItems)

const perimetresIds = _selectedItems.map((_selected) => _selected.cohort_id ?? null)
navigate(`/perimeters?${perimetresIds}`)
}
Expand Down

0 comments on commit d46877f

Please sign in to comment.