-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ensure app version is returned for bundled apps [DHIS2-19138] #3236
Conversation
For apps that are bundled and don't have a manually installed version, api/apps doesn't return anything. This causes dashboard to think there isn't an installed version of the app/plugin and shows a warning in the dashboard item. The app version should be also looked up in the bundled apps list.
🚀 Deployed on https://pr-3236.dashboard.netlify.dhis2.org |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, except for the lint error that should be addressed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some general suggestions for refactoring this for readability and getting rid of the ESLint warning, but I have also spotted a "real" problem with the current implementation:
- The
appVersions
state is being initialised as an empty array - The final
appVersions
state is computed with the results of a GET request - The children are being rendered immediately, which means that while the GET request is pending, the descending components are not able to read the app-versions
- So ideally, I guess this component requires a loading state (and perhaps also an error state). But at the very least, it should render the children conditionally, i.e.
{appVersions.length > 0 ? children : null}
Some more general suggestions:
- Consider consolidating the "all the app fetching logic" into one place. So this would mean removing the get for
apps
from theCachedDataProvider
and moving it to theInstalledAppVersionsProvider
*. You could useuseDataQuery
for this. - Consider moving the fetch for bundled apps to dedicated hook:
useFetchBundledApps
, which mimics theuseDataQuery
behaviour (i.e. it should return{ data, error, loading }
- After implementing the suggestions above, it should be easy to clean up the provider component
[*] I realise that after doing this, we'll have to scan the full codebase and identify places where we read apps
from the useCachedDataQuery
hook, and then change it. But I don't think that would be too disruptive.
The handling for apps (both bundled and installed) will likely change and hopefully get simplified when/if api/apps will return all apps data.
Should silence some sonarqube complaint.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
|
dashboards-app
|
Project |
dashboards-app
|
Branch Review |
fix/bundled-app-versions
|
Run status |
|
Run duration | 01m 29s |
Commit |
|
Committer | Edoardo Sabadelli |
View all properties for this run ↗︎ |
Test results | |
---|---|
|
0
|
|
0
|
|
0
|
|
0
|
|
4
|
View all changes introduced in this branch ↗︎ |
## [101.0.4](v101.0.3...v101.0.4) (2025-03-05) ### Bug Fixes * retrieve the correct plugin versions for installed and bundled apps [DHIS2-19138] ([#3236](#3236)) ([4082158](4082158))
🎉 This PR is included in version 101.0.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Implements DHIS2-19138
Key features
api/apps
Description
For apps that are bundled and don't have a manually installed version,
api/apps
returns nothing.This causes dashboard to think there isn't an installed version of the app/plugin and shows a warning in the dashboard item. The app version should be looked up in the bundled apps list before returning "no version" (0.0.0).
TODO
Screenshots
Before.

For bundled apps with no manually installed version,
api/apps
returns nothing.A warning is shown in the dashboard item:
After.

The app version is looked up first in
api/apps
and then indhis-web-apps/apps-bundle.json
: