@openmrs/esm-patient-common-lib 8.2.1-pre.6260 → 8.2.1-pre.6277

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmrs/esm-patient-common-lib",
3
- "version": "8.2.1-pre.6260",
3
+ "version": "8.2.1-pre.6277",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Library for common patient chart components",
6
6
  "browser": "dist/openmrs-esm-patient-common-lib.js",
@@ -71,8 +71,14 @@ export async function postOrders(encounterUuid: string, abortController: AbortCo
71
71
  const orders = patientItems[grouping];
72
72
  for (let i = 0; i < orders.length; i++) {
73
73
  const order = orders[i];
74
- const dto = postDataPrepFunctions[grouping](order, patientUuid, encounterUuid);
75
- await postOrder(dto, abortController).catch((error) => {
74
+ const dataPrepFn = postDataPrepFunctions[grouping];
75
+
76
+ if (typeof dataPrepFn !== 'function') {
77
+ console.warn(`The postDataPrep function registered for ${grouping} orders is not a function`);
78
+ continue;
79
+ }
80
+
81
+ await postOrder(dataPrepFn(order, patientUuid, encounterUuid), abortController).catch((error) => {
76
82
  erroredItems.push({
77
83
  ...order,
78
84
  orderError: error,