Skip to content

Commit

Permalink
fix for create custom concept icon
Browse files Browse the repository at this point in the history
  • Loading branch information
suruchee committed Sep 14, 2021
1 parent 90ea5f9 commit acd9f55
Showing 1 changed file with 24 additions and 28 deletions.
52 changes: 24 additions & 28 deletions src/apps/concepts/pages/ViewConceptsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,7 @@ const ViewConceptsPage: React.FC<Props> = ({

const { replace: goTo } = useHistory(); // replace because we want to keep the back button useful
const { pathname: url } = useLocation();
const [containerUrl, setContainerUrl] = useState("");

useEffect(() => {
setContainerUrl(url.replace("/concepts", ""));
}, [url]);
const containerUrl = url.replace("/concepts", "");

const { ownerType, owner } = useParams<{
ownerType: string;
Expand Down Expand Up @@ -239,30 +235,30 @@ const ViewConceptsPage: React.FC<Props> = ({
};

useEffect(() => {
// we don't make this reactive(only depend on the initial values), because the requirement
// was only trigger queries on user search(enter or apply filters, or change page)
containerType === SOURCE_CONTAINER ||
containerType === SOURCE_VERSION_CONTAINER
? retrieveSource(containerUrl)
: retrieveDictionary(containerUrl);
// we don't make this reactive(only depend on the initial values), because the requirement
// was only trigger queries on user search(enter or apply filters, or change page)
containerType === SOURCE_CONTAINER ||
containerType === SOURCE_VERSION_CONTAINER
? retrieveSource(containerUrl)
: retrieveDictionary(containerUrl);

retrieveConcepts({
conceptsUrl: isImporting
? includeAddedConcepts
? url
: excludeAddedConceptsUrl
: url,
page: page,
limit: limit,
q: initialQ,
sortDirection: sortDirection,
sortBy: sortBy,
dataTypeFilters: initialDataTypeFilters,
classFilters: initialClassFilters,
sourceFilters: initialSourceFilters,
includeRetired: initialGeneralFilters.includes("Include Retired"),
includeAdded: generalFilters.includes("Include Added Concepts")
});
retrieveConcepts({
conceptsUrl: isImporting
? includeAddedConcepts
? url
: excludeAddedConceptsUrl
: url,
page: page,
limit: limit,
q: initialQ,
sortDirection: sortDirection,
sortBy: sortBy,
dataTypeFilters: initialDataTypeFilters,
classFilters: initialClassFilters,
sourceFilters: initialSourceFilters,
includeRetired: initialGeneralFilters.includes("Include Retired"),
includeAdded: generalFilters.includes("Include Added Concepts")
});
// i don't know how the comparison algorithm works, but for these arrays, it fails.
// stringify the arrays to work around that
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down

0 comments on commit acd9f55

Please sign in to comment.