openmrs / openmrs-esm-form-builder

OpenMRS Form Builder microfrontend
Other
7 stars 70 forks source link

Form Builder crashes from unexpected concept IDs in JSON #106

Open gracepotma opened 1 year ago

gracepotma commented 1 year ago

Scenario: This happened to me when I thought we had a concept in dev3 that we actually did not yet. I can see this happening if an organization is pasting a JSON schema from elsewhere e.g. trying to reuse an existing form, or during testing.

Steps:

  1. Go to any form, existing or new
  2. In the JSON, add an answer option that uses with a concept ID that doesn't exist in the distro (e.g. you can test/reproduce using this example concept which we should never have in the RefApp)
  3. Try to Save
  4. Get stuck in infinite loading state, even if you leave and come back to that form.

Expected: An error message to the effect of "The concept in line ____ does not exist in your EMR. Please add that concept or use a different one." ...and of course, no more stuck-in-infinite-loading.

imrakesh-1 commented 1 year ago

Go back to the form editor where you encountered the infinite loading state. Locate the JSON code section that caused the issue. Find the line that references the non-existent concept ID. Remove the invalid concept ID or replace it with a valid one that exists in the system. Save the changes to the JSON code. Try to reload the form to ensure that it no longer gets stuck in an infinite loading state.