Skip to content

Commit 79ee029

Browse files
committed
MMT-4089: Editing based on CMR feedback
1 parent 8e305ea commit 79ee029

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

static/src/js/components/CollectionAssociationForm/CollectionAssociationForm.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,14 @@ const CollectionAssociationForm = () => {
286286
if (derivedConceptType === conceptIdTypes.O) {
287287
navigate(`/order-options/${conceptId}`)
288288
} else {
289+
getConcept({
290+
variables: {
291+
params: {
292+
conceptId
293+
}
294+
}
295+
})
296+
289297
navigate(`/${pluralize(camelCase(derivedConceptType)).toLowerCase()}/${conceptId}/collection-association`)
290298
}
291299

static/src/js/components/ManageCollectionAssociation/ManageCollectionAssociation.jsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,17 @@ const ManageCollectionAssociation = () => {
7474
}
7575

7676
const { data, refetch } = useSuspenseQuery(conceptTypeQueries[derivedConceptType], {
77-
variables: params,
78-
fetchPolicy: 'network-only'
77+
variables: params
7978
})
8079

8180
const [deleteAssociationMutation] = useMutation(DELETE_ASSOCIATION, {
81+
refetchQueries: [
82+
{
83+
query: conceptTypeQueries[derivedConceptType],
84+
variables: params
85+
}
86+
],
87+
awaitRefetchQueries: true,
8288
onCompleted: () => {
8389
setShowDeleteModal(false)
8490

@@ -89,7 +95,8 @@ const ManageCollectionAssociation = () => {
8995
})
9096

9197
setCollectionConceptIds([])
92-
refetch() // Refetch the data to update the associated collections list
98+
console.log('refetching in onComplete in ManageCollectionAssociation....')
99+
refetch()
93100
},
94101
onError: () => {
95102
setShowDeleteModal(false)

static/src/js/components/ManageCollectionAssociation/__tests__/ManageCollectionAssociation.test.jsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,15 @@ describe('ManageCollectionAssociation', () => {
226226
describe('when selecting Yes in the modal and results in a success ', () => {
227227
test('should remove the deleted collection', async () => {
228228
const { user } = setup({
229-
overrideMocks: [
230-
deletedAssociationResponse,
229+
additionalMocks: [
231230
deleteAssociationResponse,
231+
deletedAssociationResponse,
232232
deletedAssociationResponse
233233
]
234234
})
235+
await screen.findByText('Showing 2 Collection Associations')
235236

236-
const checkboxes = await screen.findAllByRole('checkbox')
237+
const checkboxes = screen.queryAllByRole('checkbox')
237238
const firstCheckbox = checkboxes[0]
238239

239240
await user.click(firstCheckbox)
@@ -247,6 +248,7 @@ describe('ManageCollectionAssociation', () => {
247248
const yesButton = screen.getByRole('button', { name: 'Yes' })
248249
await user.click(yesButton)
249250

251+
await screen.findByText('Showing 1 Collection Association')
250252
expect(screen.getByText('CIESIN_SEDAC_ESI_2001')).toBeInTheDocument()
251253
})
252254
})

0 commit comments

Comments
 (0)