Skip to content

fix: [DHIS2-21544] Enrollment note: failed saves leave stale optimistic note in state#4577

Open
henrikmv wants to merge 1 commit into
masterfrom
hv/fix/DHIS2-21544_failed-saves-leave-stale-optimistic-enrollment-note-in-state
Open

fix: [DHIS2-21544] Enrollment note: failed saves leave stale optimistic note in state#4577
henrikmv wants to merge 1 commit into
masterfrom
hv/fix/DHIS2-21544_failed-saves-leave-stale-optimistic-enrollment-note-in-state

Conversation

@henrikmv
Copy link
Copy Markdown
Contributor

@henrikmv henrikmv commented May 21, 2026

DHIS2-21544

This PR adds error handling for when saving an enrollment note fails (ADD_NOTE_FAILED_FOR_ENROLLMENT). Currently, notes are optimistically added to the UI, but if the server request fails, the note lingers with no indication of failure.

The fix introduces two behaviours on failure:

  • Rollback: Remove the optimistically-added note from the enrollment state.
  • User feedback: Show an error message "Could not save note".

New epic removeNoteForEnrollmentEpic listens for the failure action and dispatches removeEnrollmentNote, which the enrollment reducer handles by filtering out the failed note.

@henrikmv henrikmv requested a review from a team as a code owner May 21, 2026 19:40
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant