Skip to content

Commit

Permalink
fix: revert uid on failed save
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikhaugstulen committed Apr 3, 2024
1 parent 295166f commit 88e5e65
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
getStageWithOpenAfterEnrollment,
PAGES,
} from './helpers';
import { cleanUpUid } from '../NewPage.actions';

export const startSavingNewTrackedEntityInstanceEpic: Epic = (action$: InputObservable) =>
action$.pipe(
Expand Down Expand Up @@ -140,3 +141,11 @@ export const completeSavingNewTrackedEntityInstanceWithEnrollmentEpic = (
}));
}),
);

export const failedSavingNewTrackedEntityInstanceWithEnrollmentEpic = (
action$: InputObservable,
) =>
action$.pipe(
ofType(registrationFormActionTypes.NEW_TRACKED_ENTITY_INSTANCE_WITH_ENROLLMENT_SAVE_FAILED),
map(() => cleanUpUid()),
);
3 changes: 2 additions & 1 deletion src/epics/trackerCapture.epics.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ import {
} from '../core_modules/capture-core/components/DataEntries/TeiRegistrationEntry/TeiRegistrationEntry.epics';
import {
completeSavingNewTrackedEntityInstanceEpic,
completeSavingNewTrackedEntityInstanceWithEnrollmentEpic,
completeSavingNewTrackedEntityInstanceWithEnrollmentEpic, failedSavingNewTrackedEntityInstanceWithEnrollmentEpic,
startSavingNewTrackedEntityInstanceEpic,
startSavingNewTrackedEntityInstanceWithEnrollmentEpic,
} from '../core_modules/capture-core/components/Pages/New/RegistrationDataEntry/RegistrationDataEntry.epics';
Expand Down Expand Up @@ -341,6 +341,7 @@ export const epics = combineEpics(
startSavingNewTrackedEntityInstanceWithEnrollmentEpic,
completeSavingNewTrackedEntityInstanceEpic,
completeSavingNewTrackedEntityInstanceWithEnrollmentEpic,
failedSavingNewTrackedEntityInstanceWithEnrollmentEpic,
changedEnrollmentIdEpic,
fetchEnrollmentIdEpic,
verifyEnrollmentIdSuccessEpic,
Expand Down

0 comments on commit 88e5e65

Please sign in to comment.