Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) Add optional chaining to extensions mapping in VisitSummary com…
…ponent This fix addresses a potential runtime error in the VisitSummary component when a visit has no extensions. The error occurs due to recent changes in the [useConnectedExtensions](openmrs/openmrs-esm-core#1154) hook, which possibly now loads extensions asynchronously. The [current implementation](https://github.com/openmrs/openmrs-esm-patient-chart/blob/3b13b5b5d7ce39dbe54508a2041ececb28f2d33e/packages/esm-patient-chart-app/src/visit/visits-widget/past-visits-components/visit-summary.component.tsx#L157) assumes extensions are always available when rendering. If extensions are not yet loaded when the component renders, it throws an error. I've remedied this by adding optional chaining to the extensions mapping. This ensures the component gracefully handles cases where extensions are undefined or not yet loaded.
- Loading branch information