fix: fixed issue in react hook order during search (#106)

This commit is contained in:
Anoop M D 2023-02-26 14:51:55 +05:30
parent 3f6fcdd582
commit b1edaba1c6

View File

@ -55,12 +55,6 @@ const Collection = ({ collection, searchText }) => {
dispatch(collectionClicked(collection.uid));
};
if (searchText && searchText.length) {
if (!doesCollectionHaveItemsMatchingSearchText(collection, searchText)) {
return null;
}
}
const handleExportClick = () => {
const collectionCopy = cloneDeep(collection);
exportCollection(transformCollectionToSaveToIdb(collectionCopy));
@ -80,6 +74,12 @@ const Collection = ({ collection, searchText }) => {
})
});
if (searchText && searchText.length) {
if (!doesCollectionHaveItemsMatchingSearchText(collection, searchText)) {
return null;
}
}
// we need to sort request items by seq property
const sortRequestItems = (items = []) => {
return items.sort((a, b) => a.seq - b.seq);