@openmrs/esm-form-engine-lib 2.1.0-pre.1382 → 2.1.0-pre.1386

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-form-engine-lib",
3
- "version": "2.1.0-pre.1382",
3
+ "version": "2.1.0-pre.1386",
4
4
  "description": "React Form Engine for O3",
5
5
  "browser": "dist/openmrs-esm-form-engine-lib.js",
6
6
  "main": "src/index.ts",
@@ -29,7 +29,7 @@ export const ProgramStateAdapter: FormFieldValueAdapter = {
29
29
  .filter((state) => !state.endDate)
30
30
  .find((state) => state.state.programWorkflow?.uuid === field.questionOptions.workflowUuid)?.state;
31
31
  field.meta = { ...(field.meta || {}), previousValue: currentState };
32
- return currentState.uuid;
32
+ return currentState?.uuid;
33
33
  }
34
34
  return null;
35
35
  },
@@ -77,6 +77,7 @@ const contextInitializableTypes = [
77
77
  'encounterLocation',
78
78
  'patientIdentifier',
79
79
  'encounterRole',
80
+ 'programState'
80
81
  ];
81
82
  export class EncounterFormProcessor extends FormProcessor {
82
83
  prepareFormSchema(schema: FormSchema) {
@@ -83,7 +83,7 @@ export const FormFactoryProvider: React.FC<FormFactoryProviderProps> = ({
83
83
  const registerForm = useCallback((formId: string, context: FormContextProps) => {
84
84
  if (!rootForm.current) {
85
85
  rootForm.current = context;
86
- } else {
86
+ } else if (rootForm.current.formJson.name !== formId) {
87
87
  subForms.current[formId] = context;
88
88
  }
89
89
  }, []);