Skip to content

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

Open
henrikmv wants to merge 13 commits into
hv/fix/DHIS2-21580_sequential-errors-are-not-shown-FeedbackBarfrom
hv/fix/DHIS2-21544_failed-saves-leave-stale-optimistic-enrollment-note-in-state
Open

fix: [DHIS2-21544] Failed saves leave stale optimistic note in state#4577
henrikmv wants to merge 13 commits into
hv/fix/DHIS2-21580_sequential-errors-are-not-shown-FeedbackBarfrom
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 when note saves fail (both enrollment and event notes):

  1. Error feedback: Users now see an error message when a note fails to save.
  2. Enrollment note rollback: A new epic removes the optimistically-added enrollment note from state on failure.
  3. Event note simplification: The redundant dual-store pattern (notes tracked in both dataEntry and events stores) is removed. The ClientNote/FormNote types are consolidated into a single FormNote with clientId.

Key behavioral change on failure:

// Enrollment note failure (NEW):
//   → removeEnrollmentNote (rollback)
//   → error feedback
//
// Event note failure (SIMPLIFIED):
//   before: batchActions([
//     removeNote(...),
//     removeEventNote(...)
//   ])
//   after:  removeNote(...)
//   → error feedback

@henrikmv henrikmv requested a review from a team as a code owner May 21, 2026 19:40
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

Copy link
Copy Markdown
Contributor

@simonadomnisoru simonadomnisoru left a comment

Choose a reason for hiding this comment

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

Good catch!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 26, 2026

@henrikmv henrikmv changed the title fix: [DHIS2-21544] Enrollment note: failed saves leave stale optimistic note in state fix: [DHIS2-21544] Failed saves leave stale optimistic note in state May 26, 2026
@henrikmv henrikmv requested a review from simonadomnisoru May 26, 2026 11:27
@henrikmv henrikmv added testing and removed testing labels May 28, 2026
…4588)

Bumps [@dhis2/cli-app-scripts](https://github.com/dhis2/app-platform/tree/HEAD/cli) from 12.11.0 to 12.11.1.
- [Release notes](https://github.com/dhis2/app-platform/releases)
- [Changelog](https://github.com/dhis2/app-platform/blob/master/CHANGELOG.md)
- [Commits](https://github.com/dhis2/app-platform/commits/v12.11.1/cli)

---
updated-dependencies:
- dependency-name: "@dhis2/cli-app-scripts"
  dependency-version: 12.11.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

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 found 0 new potential issues.

View 4 additional findings in Devin Review.

Open in Devin Review

dependabot Bot added 2 commits May 28, 2026 11:02
Bumps [@babel/eslint-parser](https://github.com/babel/babel/tree/HEAD/eslint/babel-eslint-parser) from 7.28.0 to 7.28.6.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.28.6/eslint/babel-eslint-parser)

---
updated-dependencies:
- dependency-name: "@babel/eslint-parser"
  dependency-version: 7.28.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [typeface-roboto](https://github.com/KyleAMathews/typefaces) from 0.0.75 to 1.1.13.
- [Commits](KyleAMathews/typefaces@v0.0.75...v1.1.13)

---
updated-dependencies:
- dependency-name: typeface-roboto
  dependency-version: 1.1.13
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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 found 0 new potential issues.

View 5 additional findings in Devin Review.

Open in Devin Review

@henrikmv henrikmv requested a review from simonadomnisoru May 28, 2026 09:42
@henrikmv henrikmv changed the base branch from master to hv/fix/DHIS2-21580_sequential-errors-are-not-shown-FeedbackBar May 28, 2026 12:41
henrikmv added 4 commits May 28, 2026 16:06
…backBar' into hv/fix/DHIS2-21544_failed-saves-leave-stale-optimistic-enrollment-note-in-state
…backBar' into hv/fix/DHIS2-21544_failed-saves-leave-stale-optimistic-enrollment-note-in-state
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 found 0 new potential issues.

View 1 additional finding in Devin Review.

Open in Devin Review

@sonarqubecloud
Copy link
Copy Markdown

@henrikmv henrikmv marked this pull request as draft May 29, 2026 10:21
@henrikmv henrikmv marked this pull request as ready for review May 29, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants