diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..6f7f377 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16 diff --git a/src/pages/AppHubApp/AppHubApp.js b/src/pages/AppHubApp/AppHubApp.js index d9e5a64..6b8bd44 100644 --- a/src/pages/AppHubApp/AppHubApp.js +++ b/src/pages/AppHubApp/AppHubApp.js @@ -48,11 +48,20 @@ export const AppHubApp = ({ match }) => { ) } - // ToDo: This check here is the cause of the bug https://dhis2.atlassian.net/browse/DHIS2-15586 - // custom apps seem to not have an app_hub_id, when these are surfaced then this should be resolved - // otherwise we need to find a different way to match the app ( || app.name === appHubApp.name would work but not reliable) + // ToDo: This is a workaround to match non-core apps to fix this bug https://dhis2.atlassian.net/browse/DHIS2-15586 + // we don't have an app ID for these apps, so we can't reliably match them. This is the best we can do for now: + // to match with the name + developer email + const matchesNonCoreApp = (installedApp, appHubDetails) => { + return ( + !installedApp.app_hub_id && + installedApp.name === appHubDetails.name && + installedApp.developer?.email === appHubDetails.developer?.email + ) + } + const installedApp = installedApps.find( - (app) => app.app_hub_id === appHubId + (app) => + app.app_hub_id === appHubId || matchesNonCoreApp(app, appHubApp) ) return (