Skip to content

Commit

Permalink
(fix) Fix the URLs to load importmap and routes registry JSON (#1140)
Browse files Browse the repository at this point in the history
* Fix the condition for checking the importmap and routes registry url

* Update documentation
  • Loading branch information
vasharma05 authored Sep 5, 2024
1 parent 97fbc82 commit 3695a69
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
12 changes: 7 additions & 5 deletions packages/framework/esm-framework/docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -7214,7 +7214,9 @@ with the key "webservices.rest.maxResultsDefault". See: https://openmrs.atlassia

This hook fetches data from a paginated rest endpoint, initially by fetching the first page of the results.
It provides a callback to load data from subsequent pages as needed. This hook is intended to serve UIs that
provide infinite loading / scrolling of results.
provide infinite loading / scrolling of results. Unlike `useOpenmrsPagination`, this hook does not allow random access
(and lazy-loading) of any arbitrary page; rather, it fetches pages sequentially starting form the initial page, and the next page
is fetched by calling `loadMore`. See: https://swr.vercel.app/docs/pagination#useswrinfinite

**`see`** `useOpenmrsPagination`

Expand Down Expand Up @@ -7243,7 +7245,7 @@ a UseServerInfiniteReturnObject object

#### Defined in

[packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts:97](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts#L97)
[packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts:99](https://github.com/openmrs/openmrs-esm-core/blob/main/packages/framework/esm-react-utils/src/useOpenmrsInfinite.ts#L99)

___

Expand Down Expand Up @@ -7385,7 +7387,7 @@ ___

### age

▸ **age**(`birthDate`, `currentDate?`): `string`
▸ **age**(`birthDate`, `currentDate?`): `string` \| ``null``

Gets a human readable and locale supported representation of a person's age, given their birthDate,
The representation logic follows the guideline here:
Expand All @@ -7396,12 +7398,12 @@ https://webarchive.nationalarchives.gov.uk/ukgwa/20160921162509mp_/http://system

| Name | Type | Description |
| :------ | :------ | :------ |
| `birthDate` | `undefined` \| ``null`` \| `string` \| `number` \| `Date` \| `Dayjs` | The birthDate. |
| `birthDate` | `undefined` \| ``null`` \| `string` \| `number` \| `Date` \| `Dayjs` | The birthDate. If birthDate is null, returns null. |
| `currentDate` | `undefined` \| ``null`` \| `string` \| `number` \| `Date` \| `Dayjs` | Optional. If provided, calculates the age of the person at the provided currentDate (instead of now). |

#### Returns

`string`
`string` \| ``null``

A human-readable string version of the age.

Expand Down
12 changes: 10 additions & 2 deletions packages/shell/esm-app-shell/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ const openmrsEnvironment = process.env.OMRS_ENV || process.env.NODE_ENV || '';
const openmrsOffline = process.env.OMRS_OFFLINE === 'enable';
const openmrsDefaultLocale = process.env.OMRS_ESM_DEFAULT_LOCALE || 'en';
const openmrsImportmapDef = process.env.OMRS_ESM_IMPORTMAP;
const openmrsImportmapUrl = process.env.OMRS_ESM_IMPORTMAP_URL || `${openmrsPublicPath}/importmap.json`;
const openmrsImportmapUrl = process.env.OMRS_ESM_IMPORTMAP_URL
? !process.env.OMRS_ESM_IMPORTMAP_URL.startsWith('/') && !process.env.OMRS_ESM_IMPORTMAP_URL.startsWith('http')
? process.env.OMRS_ESM_IMPORTMAP_URL
: `${openmrsPublicPath}/${process.env.OMRS_ESM_IMPORTMAP_URL}`
: `${openmrsPublicPath}/importmap.json`;
const openmrsRoutesDef = process.env.OMRS_ROUTES;
const openmrsRoutesUrl = process.env.OMRS_ROUTES_URL || `${openmrsPublicPath}/routes.registry.json`;
const openmrsRoutesUrl = process.env.OMRS_ROUTES_URL
? !process.env.OMRS_ROUTES_URL.startsWith('/') && !process.env.OMRS_ROUTES_URL.startsWith('http')
? process.env.OMRS_ROUTES_URL
: `${openmrsPublicPath}/${process.env.OMRS_ROUTES_URL}`
: `${openmrsPublicPath}/routes.registry.json`;
const openmrsCoreApps = process.env.OMRS_ESM_CORE_APPS_DIR || resolve(__dirname, '../../apps');
const openmrsConfigUrls = (process.env.OMRS_CONFIG_URLS || '')
.split(';')
Expand Down

0 comments on commit 3695a69

Please sign in to comment.