Skip to content

Commit

Permalink
OpenConceptLab/ocl_issues#1408 | on new mapping create refreshing sug…
Browse files Browse the repository at this point in the history
…gested sources
  • Loading branch information
snyaggarwal committed Dec 9, 2022
1 parent 19f0b5b commit 3a5f9f0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/concepts/ConceptHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import alertifyjs from 'alertifyjs';
import Split from 'react-split'
import { CircularProgress } from '@mui/material';
import { get, isObject, isBoolean, has, flatten, values, isArray } from 'lodash';
import { get, isObject, isBoolean, has, flatten, values, isArray, find } from 'lodash';
import APIService from '../../services/APIService';
import { toParentURI, currentUserHasAccess } from '../../common/utils'
import NotFound from '../common/NotFound';
Expand Down Expand Up @@ -203,8 +203,12 @@ class ConceptHome extends React.Component {
onCreateNewMapping = (payload, targetConcept, isDirect, successCallback) => {
const { concept, mappings, reverseMappings } = this.state
const URL = `${concept.owner_url}sources/${concept.source}/mappings/`
const targetSourceURL = toParentURI(targetConcept.url)
const refetchMappedSources = !find(this.state.mappedSources, {url: targetSourceURL})
APIService.new().overrideURL(URL).post(payload).then(response => {
if(response.status === 201) {
if(refetchMappedSources)
this.fetchParentMappedSources()
alertifyjs.success('Success')
let newMapping = {
...response.data,
Expand Down

0 comments on commit 3a5f9f0

Please sign in to comment.