diff --git a/src/containers/Chat/ChatMessages/AddToCollection/AddToCollection.test.tsx b/src/containers/Chat/ChatMessages/AddToCollection/AddToCollection.test.tsx index ef52f7cd8..a6c0a38d5 100644 --- a/src/containers/Chat/ChatMessages/AddToCollection/AddToCollection.test.tsx +++ b/src/containers/Chat/ChatMessages/AddToCollection/AddToCollection.test.tsx @@ -44,8 +44,6 @@ vi.mock('common/notification', async (importOriginal) => { test('it should have add contact to collection dialog box ', async () => { const { getByText, getByTestId } = render(addContacts); - expect(getByTestId('loader')).toBeInTheDocument(); - await waitFor(() => { expect(getByTestId('autocomplete-element')).toBeInTheDocument(); }); @@ -58,8 +56,6 @@ test('it should have add contact to collection dialog box ', async () => { test('click on cancel button ', async () => { const { getByText, getByTestId } = render(addContacts); - expect(getByTestId('loader')).toBeInTheDocument(); - await waitFor(() => { expect(getByTestId('autocomplete-element')).toBeInTheDocument(); }); @@ -72,8 +68,6 @@ test('click on cancel button ', async () => { test('save without changing anything', async () => { const { getByText, getByTestId } = render(addContacts); - expect(getByTestId('loader')).toBeInTheDocument(); - await waitFor(() => { expect(getByTestId('autocomplete-element')).toBeInTheDocument(); }); @@ -88,8 +82,6 @@ test('save without changing anything', async () => { test('change value in dialog box', async () => { const { getByTestId, getAllByTestId } = render(addContacts); - expect(getByTestId('loader')).toBeInTheDocument(); - await waitFor(() => { expect(getByTestId('autocomplete-element')).toBeInTheDocument(); }); @@ -108,8 +100,6 @@ test('change value in dialog box', async () => { test('should add contact to collection', async () => { const { getByTestId, getByText } = render(addContacts); - expect(getByTestId('loader')).toBeInTheDocument(); - await waitFor(() => { expect(getByTestId('autocomplete-element')).toBeInTheDocument(); }); @@ -142,8 +132,6 @@ const addGroups = ( test('it should have "add group to collection" dialog box ', async () => { const { getByText, getByTestId } = render(addGroups); - expect(getByTestId('loader')).toBeInTheDocument(); - await waitFor(() => { expect(getByTestId('autocomplete-element')).toBeInTheDocument(); }); @@ -154,8 +142,6 @@ test('it should have "add group to collection" dialog box ', async () => { test('should add whatsapp group to collection', async () => { const { getByTestId, getByText } = render(addGroups); - expect(getByTestId('loader')).toBeInTheDocument(); - await waitFor(() => { expect(getByTestId('autocomplete-element')).toBeInTheDocument(); }); diff --git a/src/containers/Chat/ChatMessages/AddToCollection/AddToCollection.tsx b/src/containers/Chat/ChatMessages/AddToCollection/AddToCollection.tsx index c2edeea19..2c20499ae 100644 --- a/src/containers/Chat/ChatMessages/AddToCollection/AddToCollection.tsx +++ b/src/containers/Chat/ChatMessages/AddToCollection/AddToCollection.tsx @@ -11,7 +11,6 @@ import { } from 'graphql/mutations/Collection'; import { SearchDialogBox } from 'components/UI/SearchDialogBox/SearchDialogBox'; import { GET_WA_GROUPS } from 'graphql/queries/WaGroups'; -import { Loading } from 'components/UI/Layout/Loading/Loading'; interface AddToCollectionProps { collectionId: string | undefined; @@ -27,7 +26,7 @@ export const AddToCollection = ({ collectionId, setDialog, groups }: AddToCollec let updateMutation = groups ? UPDATE_COLLECTION_WA_GROUP : UPDATE_COLLECTION_CONTACTS; let entity = groups ? 'waGroups' : 'contacts'; - const { data: entityData, loading } = useQuery(searchquery, { + const { data: entityData } = useQuery(searchquery, { variables: groups ? setVariables({}, 50) : setVariables({ name: contactSearchTerm }, 50), }); @@ -101,10 +100,6 @@ export const AddToCollection = ({ collectionId, setDialog, groups }: AddToCollec ? t('Add groups to the collection') : t('Add contacts to the collection'); - if (loading) { - return ; - } - return (