Skip to content

Commit

Permalink
fix(DHIS2-15586): update installed state for non-core apps
Browse files Browse the repository at this point in the history
  • Loading branch information
kabaros committed Dec 13, 2023
1 parent a1cee83 commit 1edbf8e
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/pages/AppHubApp/AppHubApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ export const AppHubApp = ({ match }) => {
)
}

// ToDo: This check here is the cause of the bug https://dhis2.atlassian.net/browse/DHIS2-15586
// custom apps seems 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 (
Expand Down

0 comments on commit 1edbf8e

Please sign in to comment.