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 15, 2023
1 parent 6a1531a commit 8a0eff0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v16
17 changes: 13 additions & 4 deletions src/pages/AppHubApp/AppHubApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down

0 comments on commit 8a0eff0

Please sign in to comment.