From 261d312848b5a985f9a9e4d0f92a455f29367ae7 Mon Sep 17 00:00:00 2001 From: eirikhaugstulen Date: Mon, 14 Aug 2023 11:49:54 +0200 Subject: [PATCH] fix: change program in search --- .../TeiSearch/TeiSearch.container.js | 7 ++++--- .../TEIRelationshipsWidget/TeiSearch/TeiSearch.types.js | 2 +- .../TrackedEntityRelationshipsWrapper.component.js | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TeiSearch/TeiSearch.container.js b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TeiSearch/TeiSearch.container.js index d83ee31c00..2480abe886 100644 --- a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TeiSearch/TeiSearch.container.js +++ b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TeiSearch/TeiSearch.container.js @@ -15,15 +15,16 @@ import { getSearchGroups } from './getSearchGroups'; import { getTrackedEntityTypeThrowIfNotFound } from '../../../../../metaData'; const mapStateToProps = (state: ReduxState, props: OwnProps) => { - const { selectedProgramId, selectedTrackedEntityTypeId } = props; - const searchGroups = getSearchGroups(selectedTrackedEntityTypeId, selectedProgramId); - const { name } = getTrackedEntityTypeThrowIfNotFound(selectedTrackedEntityTypeId); const currentTeiSearch = state.teiSearch[props.id] ?? {}; + const { selectedTrackedEntityTypeId } = props; + const searchGroups = getSearchGroups(selectedTrackedEntityTypeId, currentTeiSearch.selectedProgramId); + const { name } = getTrackedEntityTypeThrowIfNotFound(selectedTrackedEntityTypeId); return { searchGroups, showResults: !!currentTeiSearch.searchResults, openSearchGroupSection: currentTeiSearch.openSearchGroupSection, trackedEntityTypeName: name.toLowerCase(), + selectedProgramId: currentTeiSearch.selectedProgramId, }; }; diff --git a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TeiSearch/TeiSearch.types.js b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TeiSearch/TeiSearch.types.js index b730ab69e4..f1d3321375 100644 --- a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TeiSearch/TeiSearch.types.js +++ b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TeiSearch/TeiSearch.types.js @@ -6,6 +6,7 @@ type PropsFromRedux = {| showResults?: ?boolean, openSearchGroupSection: ?string, trackedEntityTypeName: string, + selectedProgramId: ?string, |} type DispatchersFromRedux = {| @@ -22,7 +23,6 @@ export type OwnProps = {| getResultsView: Function, resultsPageSize: number, selectedTrackedEntityTypeId: string, - selectedProgramId: ?string, |} export type Props = {| ...OwnProps, ...DispatchersFromRedux, ...PropsFromRedux, ...CssClasses |} diff --git a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js index cf00570c97..df27fb1125 100644 --- a/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js +++ b/src/core_modules/capture-core/components/Pages/common/TEIRelationshipsWidget/TrackedEntityRelationshipsWrapper/TrackedEntityRelationshipsWrapper.component.js @@ -89,7 +89,6 @@ export const TrackedEntityRelationshipsWrapper = ({ (