File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,11 +59,6 @@ describe('<ContainerRemover />', () => {
5959 ( { axiosMock } = initializeMocks ( ) ) ;
6060 } ) ;
6161
62- afterEach ( ( ) => {
63- jest . clearAllMocks ( ) ;
64- axiosMock . restore ( ) ;
65- } ) ;
66-
6762 it ( 'triggers update container children api call when duplicates are present' , async ( ) => {
6863 const user = userEvent . setup ( ) ;
6964 const url = getLibraryContainerChildrenApiUrl ( mockGetContainerChildren . unitIdWithDuplicate ) ;
Original file line number Diff line number Diff line change @@ -702,10 +702,10 @@ export async function restoreContainer(containerId: string) {
702702/**
703703 * Fetch a library container's children's metadata.
704704 */
705- export async function getLibraryContainerChildren < T > (
705+ export async function getLibraryContainerChildren < ChildType = LibraryBlockMetadata | Container > (
706706 containerId : string ,
707707 published : boolean = false ,
708- ) : Promise < T [ ] > {
708+ ) : Promise < ChildType [ ] > {
709709 const { data } = await getAuthenticatedHttpClient ( ) . get (
710710 getLibraryContainerChildrenApiUrl ( containerId , published ) ,
711711 ) ;
Original file line number Diff line number Diff line change @@ -736,15 +736,18 @@ export const useRestoreContainer = (containerId: string) => {
736736/**
737737 * Get the metadata and children for a container in a library
738738 */
739- export const useContainerChildren = < T extends { id : string , isNew ?: boolean } > (
740- containerId ?: string ,
741- published : boolean = false ,
742- ) => (
739+ export const useContainerChildren = < ChildType extends {
740+ id : string ;
741+ isNew ?: boolean ;
742+ } = api . LibraryBlockMetadata | api . Container > (
743+ containerId ?: string ,
744+ published : boolean = false ,
745+ ) => (
743746 useQuery ( {
744747 enabled : ! ! containerId ,
745748 queryKey : libraryAuthoringQueryKeys . containerChildren ( containerId ! ) ,
746- queryFn : ( ) => api . getLibraryContainerChildren < T > ( containerId ! , published ) ,
747- structuralSharing : ( oldData : T [ ] , newData : T [ ] ) => {
749+ queryFn : ( ) => api . getLibraryContainerChildren < ChildType > ( containerId ! , published ) ,
750+ structuralSharing : ( oldData : ChildType [ ] , newData : ChildType [ ] ) => {
748751 // This just sets `isNew` flag to new children components
749752 if ( oldData ) {
750753 const oldDataIds = oldData . map ( ( obj ) => obj . id ) ;
You can’t perform that action at this time.
0 commit comments