Skip to content

Commit

Permalink
Merge branch 'master' into allfunctionality
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskovar-m2ms authored Jan 22, 2021
2 parents f31cdcb + 2bb6a6f commit 2d72fa1
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions js/components/preview/molecule/moleculeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,20 @@ export const MoleculeList = memo(({ height, setFilterItemsHeight, filterItemsHei
}
}, [getJoinedMoleculeList, getAllMoleculeList, searchString]);

// Used for MoleculeListSortFilterDialog when using textSearch
const joinedMoleculeListsCopy = useMemo(() => [...joinedMoleculeLists], [joinedMoleculeLists]);
const addSelectedMoleculesFromUnselectedSites = useCallback((joinedMoleculeLists, list) => {
const result = [...joinedMoleculeLists];
list?.forEach(moleculeID => {
const foundJoinedMolecule = result.find(mol => mol.id === moleculeID);
if (!foundJoinedMolecule) {
const molecule = getAllMoleculeList.find(mol => mol.id === moleculeID);
if (molecule) {
result.push(molecule);
}
}
});

return result;
}, [getAllMoleculeList]);

const addSelectedMoleculesFromUnselectedSites = useCallback((joinedMoleculeLists, list) => {
const result = [...joinedMoleculeLists];
Expand Down

0 comments on commit 2d72fa1

Please sign in to comment.