Skip to content

Commit

Permalink
fix: [DHIS2-16317] Incorrect error message on orgUnit type data eleme…
Browse files Browse the repository at this point in the history
…nt (#3484)

Co-authored-by: Tony Valle <[email protected]>
  • Loading branch information
eirikhaugstulen and superskip authored Dec 20, 2023
1 parent d5d4ded commit ef30449
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const getStyles = () => ({

type OrgUnitValue = {
id: string,
displayName: string,
name: string,
path: string,
}

Expand Down Expand Up @@ -44,15 +44,15 @@ class SingleOrgUnitSelectFieldPlain extends React.Component<Props, State> {
const { classes } = this.props;
return (
<div className={classes.selectedOrgUnitContainer}>
<Chip onRemove={this.onDeselectOrgUnit}>{selectedOrgUnit.displayName}</Chip>
<Chip onRemove={this.onDeselectOrgUnit}>{selectedOrgUnit.name}</Chip>
</div>
);
}

onSelectOrgUnit = (orgUnit: Object) => {
this.props.onBlur({
id: orgUnit.id,
displayName: orgUnit.displayName,
name: orgUnit.displayName,
path: orgUnit.path,
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
} from '../../../NewRelationship/TeiRelationship/SearchResults/TeiRelationshipSearchResults.component';
import { ResultsPageSizeContext } from '../../../shared-contexts';
import { RegisterTei } from '../RegisterTei';
import { useOrganisationUnit } from '../../../../../dataQueries';
import { useCoreOrgUnit } from '../../../../../metadataRetrieval/coreOrgUnit';

export const TrackedEntityRelationshipsWrapper = ({
trackedEntityTypeId,
Expand All @@ -29,7 +29,8 @@ export const TrackedEntityRelationshipsWrapper = ({
}: Props) => {
const dispatch = useDispatch();
const { relationshipTypes, isError } = useTEIRelationshipsWidgetMetadata();
const { orgUnit: initialOrgUnit } = useOrganisationUnit(orgUnitId, 'id,displayName,code');
const { orgUnit } = useCoreOrgUnit(orgUnitId);
const initialOrgUnit = orgUnit ? { id: orgUnitId, name: orgUnit.name, path: orgUnit.path } : null;

const onSelectFindMode = ({ findMode, relationshipConstraint }: OnSelectFindModeProps) => {
dispatch(selectFindMode({
Expand Down

0 comments on commit ef30449

Please sign in to comment.