v5.2.0
Highlights
Core 5.2.0
brings a number of new features and improvements and a host of bug fixes. The most notable changes are:
SWR is now a shared library
Frontend modules can now leverage the SWR as a ModuleFederation
shared dependency. This means that we can now leverage proper request deduplication and a shared cache for all API calls that use SWR. Additionally, this change should make it possible to mutate the cache from one module and have that mutation reflected in other modules.
Fixes to the openmrs
tooling
This release fixes an issue where the openmrs
tooling would fail to build frontend assets correctly. This was due to an issue with the way pure CSS files were handled by Wepback. #778 makes it so that pure CSS files are handled by the css-loader
. Additionally. we've added a check to the distro reference application that should catch build failures and show an error message.
A new useDebounce
hook
The framework now exports a useDebounce
hook that can be used to debounce requests to the backend. Previously, we've had smatterings of similar logic in various places, with one specific downside: the custom implementations used for search inputs would lead the inputs changing from controlled to uncontrolled components. This is now handled by the hook, which provides a simple API for debouncing requests. Here's a snippet showing how to leverage the hook:
import { useDebounce } from "@openmrs/esm-framework";
function SearchComponent() {
const [searchTerm, setSearchTerm] = useState('');
const debouncedSearchTerm = useDebounce(searchTerm);
const swrResult = useSWR(`/api/search?q=${debouncedSearchTerm}`)
return (
<Search
labelText={t('search', 'Search')}
onChange={(e) => setSearchTerm(e.target.value)}
value={searchTerm}
/>
)
}
export default SearchComponent;
Introduction of a locale-sensitive date picker that supports the Ethiopian calendar
The framework now provides a locale-sensitive datepicker with support for the Ethiopian calendar. For Ethiopian locales (am
, am_ET
, and ti_ET
), this custom datepicker will be used as the default. The functionality for the datepicker is provided by the React Spectrum library. Future work will include providing support for registering default custom calendars on a per-locale basis using standard JS Intl APIs.
The service worker is now opt-in for local development
The service worker installation is now opt-in when running a local development server using yarn start
. To opt into installing the service worker, you can pass a --support-offline
flag to yarn start
like so:
yarn start --support-offline=true
We're working to ameliorate some of the issues with our current service worker implementation, and it's entirely feasible that this flag will default to being on in the very near future.
Features
- (feat) Make sidenav scrollable by @Jexsie in #732
- (feat) Core support for O3-2242: Separate 'active visit' and 'current visit' by @brandones in #738
- (feat) O3-2306: Add formatDate option to disable special 'today' handling by @brandones in #743
- (feat) Update type
LoggedInUser
to list userProperties in use by @vasharma05 in #744 - (feat) Allow useConfig() to load configuration from other modules by @ibacher in #751
- (feat) Tweaks to the
ActionableNotification
component by @denniskigen in #758 - (feat) Resolve template literals in the
src
prop of the logo config by @samuelmale in #749 - (feat) Adding useDebounce to the react utils by @vasharma05 in #756
- (feat) Use SWR as a shared library by @ibacher in #774
- (feat) Upgrade React Spectrum and fix CSS loading error by @ibacher in #778
- (feat) KH-372: Add Khmer translations by @kazlaw in #776
- (feat) Introduce a locale-sensitive date-picker by @samuelmale in #746
- (feat) O3-2410: Support using custom link as navbar logo by @mogoodrich in #767
- (feat) O3-2407: App Menu and User Menu should hide if their panel has no con… by @mogoodrich in #768
- (feat) O3-2409: Login: support interpolation in loginUrl and logoutUrl by @mogoodrich in #766
- (feat) Add Spanish translations by @icrc-jofrancisco in #775
- (feat) Patient age display should be localized by @vasharma05 in #765
- (feat) Make the service worker opt-in for local dev by @denniskigen in #780
Bug fixes
- (fix) Add support for hashed routes by @ibacher in #736
- (fix) Memoize the returned callback functions from usePagination by @vasharma05 in #741
- (fix) Resolve some errors that appear when an app has empty routes by @ibacher in #742
- (fix) Don't process openmrs-esm-styleguide.css files the Sass loader by @ibacher in #745
- (fix) Bug where store actions don't receive correct arguments; get rid of appState by @brandones in #747
- (fix) Simplify createGlobalStore mock by @brandones in #748
- (fix) Fix Sass version to < 1.65.0 by @ibacher in #752
- (fix) Remove duplicate top-nav-info-slot by @pirupius in #753
- (fix) Locale switcher in the primary navigation should show session locale if no default locale found by @vasharma05 in #757
- (fix) Extension online / offline support should propagate to runtime configuration by @ibacher in #761
- (fix) Offline patients are not being listed in the table by @icrc-jofrancisco in https:/
- (fix) O3-2419: Test failure due to non-breaking space by @mogoodrich in #769
- (fix) Fix ContentSwitcher style overrides by @denniskigen in #773
Housekeeping
- (chore) Tweak
pre-release
job skip logic by @denniskigen in #735 - (chore) Update ConnectedExtension and add useConnectedExtensions mock by @ibacher in #737
- (chore) Fix some typings by @ibacher in #750
- (chore) O3-2358: Utilize pre-filled docker images in e2e tests by @Piumal1999 in #759
- (chore) Add OpenMRSDatePicker to global mock file by @kajambiya in #760
- (chore) Export Datepicker as mock by @kajambiya in #764
- (chore) Bump @carbon/react and @carbon/charts by @denniskigen in #770
- (chore) O3-2113: Setup playwright and add login e2e test by @RandilaP in #740
Documentation
- (docs) Update test scripts and their related documentation by @denniskigen in #754
New contributors
- @pirupius made their first contribution in #753
- @RandilaP made their first contribution in #740
- @Piumal1999 made their first contribution in #759
- @kajambiya made their first contribution in #760
- @mogoodrich made their first contribution in #767
- @kazlaw made their first contribution in #776
Thank you to all our wonderful contributors! 🎉
Full Changelog: v5.1.0...v5.2.0