openmrs / openmrs-esm-form-engine-lib

React Form Engine library for O3
Other
10 stars 59 forks source link

(feat) Implement 'markFormAsDirty' to prompt the user before closing a dirty form #364

Closed samuelmale closed 2 months ago

samuelmale commented 2 months ago

Requirements

Summary

The workspace system exposes an API that prevents forms with draft data or unpersisted data from being closed accidentally, which could lead to data loss. This functionality was supported by the form engine prior to the migration; this PR restores that support in the form engine.

Screenshots

2024-08-09 00-42-01 2024-08-09 00_43_26

Related Issue

Other

github-actions[bot] commented 2 months ago

Size Change: -86.1 kB (-7.01%) ✅

Total Size: 1.14 MB

Filename Size Change
dist/674.js 0 B -86.2 kB (removed) 🏆
ℹ️ View Unchanged | Filename | Size | Change | | :--- | :---: | :---: | | `dist/151.js` | 300 kB | 0 B | | `dist/225.js` | 2.57 kB | 0 B | | `dist/277.js` | 1.84 kB | 0 B | | `dist/3.js` | 481 B | 0 B | | `dist/300.js` | 711 B | 0 B | | `dist/335.js` | 968 B | 0 B | | `dist/353.js` | 3.02 kB | 0 B | | `dist/41.js` | 3.37 kB | 0 B | | `dist/422.js` | 6.8 kB | 0 B | | `dist/540.js` | 2.63 kB | 0 B | | `dist/55.js` | 758 B | 0 B | | `dist/572.js` | 252 kB | +104 B (+0.04%) | | `dist/617.js` | 86.9 kB | 0 B | | `dist/635.js` | 14.3 kB | 0 B | | `dist/733.js` | 107 kB | 0 B | | `dist/901.js` | 11.8 kB | 0 B | | `dist/99.js` | 691 B | 0 B | | `dist/993.js` | 3.09 kB | 0 B | | `dist/main.js` | 340 kB | 0 B | | `dist/openmrs-esm-form-engine-lib.js` | 3.67 kB | 0 B |

compressed-size-action

denniskigen commented 2 months ago

In hindsight, maybe one improvement would be to not close the workspace when the user hits the cancel button so they don't have to manually restore it from the Side rail.

samuelmale commented 2 months ago

I agree, had the same impression. This needs to be resolved in the form-engine-app by getting rid of this call: https://github.com/openmrs/openmrs-esm-patient-chart/blob/main/packages/esm-form-engine-app/src/form-renderer/form-renderer.component.tsx#L35