Skip to content

fix(gantt-chart): show backend validation errors and rollback failed updates#174

Open
stipsitzm wants to merge 18 commits intomainfrom
codex/fix-error-handling-for-planting-plan-updates
Open

fix(gantt-chart): show backend validation errors and rollback failed updates#174
stipsitzm wants to merge 18 commits intomainfrom
codex/fix-error-handling-for-planting-plan-updates

Conversation

@stipsitzm
Copy link
Copy Markdown
Owner

Motivation

  • The Gantt calendar previously displayed only a generic "Fehler beim Aktualisieren des Anbauplans" message for backend 400 validation responses and left optimistic UI changes visible despite the backend rejecting the update.
  • Users need to see the same field-level validation messages (e.g. area_usage_sqm) as in the Planting Plans view and the calendar must remain consistent with the backend after a failed update.

Description

  • Reused the shared API helper by importing extractApiErrorMessage and used it in handleTaskUpdate to show localized field-level validation messages instead of a generic error.
  • Added a refreshPlantingPlans function and call it in the update failure path to reload planting plans from the backend and revert any optimistic changes.
  • Force a Gantt remount by introducing ganttRenderKey when an update fails to clear any stale internal drag/resize state in the chart component.
  • Kept successful update behavior unchanged (clear error and refresh weekly yield), and added tests simulating both failed (400 with area_usage_sqm) and successful update flows.

Testing

  • Ran npm test -- --run src/__tests__/GanttChart.test.tsx and all tests passed (9 tests, 9 passed).
  • Tests verify that a 400 response containing area_usage_sqm is displayed as the concrete backend message, that the planting plans are reloaded after a failed update (rollback), and that successful updates continue to work as before.

Codex Task

@github-actions github-actions Bot added the release:patch Triggers patch version bump label Apr 24, 2026
@stipsitzm
Copy link
Copy Markdown
Owner Author

@copilot fix failing test or the code

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

Labels

codex release:patch Triggers patch version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant