Skip to content

Commit ab0e0d7

Browse files
authored
refactor: remove custom order function from course libraries list (#1865) (#1888)
(cherry picked from commit bc18fff)
1 parent b30a1c8 commit ab0e0d7

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

src/course-libraries/ReviewTabContent.tsx

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ import {
1414
useToggle,
1515
} from '@openedx/paragon';
1616

17-
import {
18-
tail, keyBy, orderBy, merge, omitBy,
19-
} from 'lodash';
17+
import { tail, keyBy } from 'lodash';
2018
import { useQueryClient } from '@tanstack/react-query';
2119
import { Loop, Warning } from '@openedx/paragon/icons';
2220
import messages from './messages';
@@ -116,7 +114,6 @@ const ComponentReviewList = ({
116114
hits: downstreamInfo,
117115
isLoading: isIndexDataLoading,
118116
searchKeywords,
119-
searchSortOrder,
120117
hasError,
121118
hasNextPage,
122119
isFetchingNextPage,
@@ -143,10 +140,6 @@ const ComponentReviewList = ({
143140
() => keyBy(outOfSyncComponents, 'downstreamUsageKey'),
144141
[outOfSyncComponents],
145142
);
146-
const downstreamInfoByKey = useMemo(
147-
() => keyBy(downstreamInfo, 'usageKey'),
148-
[downstreamInfo],
149-
);
150143
const queryClient = useQueryClient();
151144

152145
useEffect(() => {
@@ -236,19 +229,6 @@ const ComponentReviewList = ({
236229
}
237230
}, [blockData]);
238231

239-
const orderInfo = useMemo(() => {
240-
if (searchSortOrder !== SearchSortOption.RECENTLY_MODIFIED) {
241-
return downstreamInfo;
242-
}
243-
if (isIndexDataLoading) {
244-
return [];
245-
}
246-
let merged = merge(downstreamInfoByKey, outOfSyncComponentsByKey);
247-
merged = omitBy(merged, (o) => !o.displayName);
248-
const ordered = orderBy(Object.values(merged), 'updated', 'desc');
249-
return ordered;
250-
}, [downstreamInfoByKey, outOfSyncComponentsByKey]);
251-
252232
if (isIndexDataLoading) {
253233
return <Loading />;
254234
}
@@ -259,7 +239,7 @@ const ComponentReviewList = ({
259239

260240
return (
261241
<>
262-
{orderInfo?.map((info) => (
242+
{downstreamInfo?.map((info) => (
263243
<BlockCard
264244
key={info.usageKey}
265245
info={info}

0 commit comments

Comments
 (0)