openmrs / openmrs-esm-form-engine-lib

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

(fix) O3-2252: Calculated values shouldn't be overwritten by the Encounter's values #318

Closed CynthiaKamau closed 3 months ago

CynthiaKamau commented 4 months ago

… values

Requirements

Summary

This PR resolves the issue of null or undefined initial values for calculated fields when entering edit mode. Previously, the assumption was that all calculated fields would be retrieved through asynchronous functions from the expression runner. This assumption led to problems when synchronous functions were used, resulting in null or undefined initial values.

Screenshots

https://www.loom.com/share/866edea9d4c34b91ab4ef3ef93eba49c?sid=7ffa7c0d-58cd-42e2-a30f-64d4448462d7

Related Issue

Other

github-actions[bot] commented 4 months ago

Size Change: -245 kB (-19.5%) 🎉

Total Size: 1.01 MB

Filename Size Change
dist/800.js 0 B -245 kB (removed) 🏆
ℹ️ View Unchanged | Filename | Size | Change | | :--- | :---: | :---: | | `dist/184.js` | 11.2 kB | 0 B | | `dist/195.js` | 76.6 kB | 0 B | | `dist/225.js` | 2.57 kB | 0 B | | `dist/29.js` | 163 kB | 0 B | | `dist/300.js` | 709 B | 0 B | | `dist/327.js` | 1.84 kB | 0 B | | `dist/335.js` | 967 B | 0 B | | `dist/353.js` | 3.02 kB | 0 B | | `dist/41.js` | 3.36 kB | 0 B | | `dist/422.js` | 6.79 kB | 0 B | | `dist/474.js` | 116 kB | -2 B (0%) | | `dist/491.js` | 9.18 kB | 0 B | | `dist/540.js` | 2.63 kB | 0 B | | `dist/55.js` | 756 B | 0 B | | `dist/635.js` | 14.3 kB | 0 B | | `dist/70.js` | 482 B | 0 B | | `dist/708.js` | 245 kB | 0 B | | `dist/776.js` | 3.2 kB | 0 B | | `dist/99.js` | 690 B | 0 B | | `dist/993.js` | 3.09 kB | 0 B | | `dist/main.js` | 343 kB | -1 B (0%) | | `dist/openmrs-form-engine-lib.js` | 3.72 kB | 0 B |

compressed-size-action

brandones commented 3 months ago

This PR addresses the issue of null/undefined values on calculated fields in edit mode . Calculated value is persisted when : -There is a default value -The encounter value is undefined -The encounter value and calculated value are the same, if different

@CynthiaKamau Please strive for greater clarity in PR summaries. "This PR addresses the issue of null/undefined values on calculated fields in edit mode" what is the issue in question? It is not obvious what "null/undefined values on calculated fields in edit mode" means or why it would be a problem. And the phrase "The encounter value and calculated value are the same, if different" doesn't make sense.

Thanks for your work on this; I hope this is useful feedback.

brandones commented 3 months ago

@CynthiaKamau Are the next steps clear to you? Any blockers?

CynthiaKamau commented 3 months ago

@CynthiaKamau Are the next steps clear to you? Any blockers?

@CynthiaKamau Are the next steps clear to you? Any blockers?

I will update the description.Thanks for the feedback

CynthiaKamau commented 3 months ago

@samuelmale do you still have any reservations on this ?