Skip to content

Commit 47c3aaf

Browse files
authored
fix(contractor-onboarding) - refetch employment after continuing (#772)
* fix(contractor-onboardign) - refetch employment after continuing * fix tests
1 parent 203c409 commit 47c3aaf

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/flows/ContractorOnboarding/hooks.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -987,8 +987,6 @@ export const useContractorOnboarding = ({
987987
}
988988
setInternalContractDocumentId(contractDocumentId);
989989

990-
await refetchEmployment();
991-
992990
return response;
993991
}
994992

@@ -1102,6 +1100,11 @@ export const useContractorOnboarding = ({
11021100
}
11031101
}
11041102

1103+
const handleNextStep = () => {
1104+
nextStep();
1105+
refetchEmployment();
1106+
};
1107+
11051108
const isLoading = initialLoading || shouldHandleReadOnlyEmployment;
11061109

11071110
return {
@@ -1136,7 +1139,7 @@ export const useContractorOnboarding = ({
11361139
* Function to handle going to the next step
11371140
* @returns {void}
11381141
*/
1139-
next: nextStep,
1142+
next: handleNextStep,
11401143

11411144
/**
11421145
* Function to handle going to a specific step

src/flows/ContractorOnboarding/tests/ContractorOnboarding.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -751,6 +751,8 @@ describe('ContractorOnboardingFlow', () => {
751751

752752
await screen.findByText(/Step: Contract Preview/i);
753753

754+
await waitForElementToBeRemoved(() => screen.getByTestId('spinner'));
755+
754756
await fillSignature();
755757

756758
// Mock signature field would be here in real scenario
@@ -1041,6 +1043,8 @@ describe('ContractorOnboardingFlow', () => {
10411043

10421044
await screen.findByText(/Step: Contract Preview/i);
10431045

1046+
await waitForElementToBeRemoved(() => screen.getByTestId('spinner'));
1047+
10441048
await fillSignature();
10451049

10461050
nextButton = screen.getByText(/Continue/i);

0 commit comments

Comments
 (0)