diff --git a/services/app-web/src/api/fakeAmplifyFetch.ts b/services/app-web/src/api/fakeAmplifyFetch.ts index 6c635dbb16..5e27713469 100644 --- a/services/app-web/src/api/fakeAmplifyFetch.ts +++ b/services/app-web/src/api/fakeAmplifyFetch.ts @@ -61,8 +61,6 @@ export async function fakeAmplifyFetch( uri: string, options: RequestInit ): Promise { - console.log('try to amplify', uri, options) - if (options.method !== 'POST') { throw new Error('unexpected GQL request') } diff --git a/services/app-web/src/pages/App/App.tsx b/services/app-web/src/pages/App/App.tsx index d11528df93..bc1cf9ff06 100644 --- a/services/app-web/src/pages/App/App.tsx +++ b/services/app-web/src/pages/App/App.tsx @@ -1,4 +1,4 @@ -import React from 'react' +import React, {useEffect} from 'react' import { BrowserRouter } from 'react-router-dom' import { ErrorBoundary } from 'react-error-boundary' import { @@ -35,7 +35,10 @@ function App({ apolloClient: ApolloClient s3Client: S3ClientT }): React.ReactElement { - logEvent('on_load', { success: true }) + + useEffect(() => { + logEvent('on_load', { success: true }) + }, []); return ( diff --git a/services/app-web/src/pages/StateSubmissionForm/ReviewSubmit/ReviewSubmit.tsx b/services/app-web/src/pages/StateSubmissionForm/ReviewSubmit/ReviewSubmit.tsx index d40708775f..3b78dd93ea 100644 --- a/services/app-web/src/pages/StateSubmissionForm/ReviewSubmit/ReviewSubmit.tsx +++ b/services/app-web/src/pages/StateSubmissionForm/ReviewSubmit/ReviewSubmit.tsx @@ -45,8 +45,21 @@ export const ReviewSubmit = ({ >(undefined) const history = useHistory() const [submitDraftSubmission] = useSubmitDraftSubmissionMutation({ - // An alternative to messing with the cache, just force refetch this query along with this one - refetchQueries: ['indexSubmissions'], + // An alternative to messing with the cache like we do with create, just zero it out. + update(cache, { data }) { + if (data) { + cache.modify({ + id: 'ROOT_QUERY', + fields: { + indexSubmissions( + _index, {DELETE} + ) { + return DELETE + }, + }, + }) + } + }, }) useEffect(() => { @@ -119,6 +132,8 @@ export const ReviewSubmit = ({ }, }) + console.log("Got data: ", data) + if (data.errors) { console.log(data.errors) showError('Error attempting to submit. Please try again.') diff --git a/tests/cypress/integration/stateSubmission.spec.ts b/tests/cypress/integration/stateSubmission.spec.ts index e67d085c8a..40f42f4af1 100644 --- a/tests/cypress/integration/stateSubmission.spec.ts +++ b/tests/cypress/integration/stateSubmission.spec.ts @@ -145,15 +145,18 @@ describe('State Submission', () => { cy.findByTestId('submission-name') .invoke('text') .then((nameText) => { - console.log('GOT TEXT', nameText) - - // Navigate to the dashboard again + // Submit the form and navigate to the dashboard again cy.navigateForm('Submit') cy.findByRole('heading', { name: 'Submissions' }).should( 'exist' ) - cy.findByText(nameText).should('exist') + cy.findByText(nameText).should('exist').then( (submittedText) => { + // find "SUBMITTED" in the card + const submissionCard = submittedText.parent().parent() + const cardStatus = submissionCard.find('span[data-testid="tag"]').html() + assert(cardStatus.indexOf('Submitted') === 0, 'Submission isnt displayed as Submitted') + }) }) })