@@ -54,11 +54,13 @@ const CompareContainersWidgetInner = ({
5454} : Props ) => {
5555 const intl = useIntl ( ) ;
5656 const { data, isError, error } = useCourseContainerChildren ( downstreamBlockId , parent . length === 0 ) ;
57+ // There is the case in which the item is removed, but it still exists
58+ // in the library, for that case, we avoid bringing the children.
5759 const {
5860 data : libData ,
5961 isError : isLibError ,
6062 error : libError ,
61- } = useContainerChildren ( upstreamBlockId , true ) ;
63+ } = useContainerChildren ( state === 'removed' ? undefined : upstreamBlockId , true ) ;
6264 const {
6365 data : containerData ,
6466 isError : isContainerTitleError ,
@@ -70,16 +72,7 @@ const CompareContainersWidgetInner = ({
7072 return [ undefined , undefined ] ;
7173 }
7274
73- let libChildren = libData as ContainerChildBase [ ] || [ ] ;
74- if ( state === 'removed' ) {
75- // There is the case in which the item is removed, but it still exists
76- // in the library, in that case the query will bring its children,
77- // but we must put it empty so that the status of all the children of
78- // the downstream are 'removed'
79- libChildren = [ ] ;
80- }
81-
82- return diffPreviewContainerChildren ( data ?. children || [ ] , libChildren ) ;
75+ return diffPreviewContainerChildren ( data ?. children || [ ] , libData as ContainerChildBase [ ] || [ ] ) ;
8376 } , [ data , libData ] ) ;
8477
8578 const renderBeforeChildren = useCallback ( ( ) => {
0 commit comments