Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: provide the app's name & version to the <HeaderBar> #674

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Mohammer5
Copy link
Contributor

@Mohammer5 Mohammer5 commented Oct 7, 2021

Closes LIBS-176 (link)
Blocked by dhis2/ui#795

  • Passes the app version & name directly to the <HeaderBar>
  • I didn't want to pass this through the app-runtime:
    • It'd be more work & make the whole thing more complicated
    • With the global shell, the headerbar would have "subscribe" to the values in order to notice the change. With a prop, this happens automatically (might be wrong.. here 馃う)
    • The "appName" is already a prop, so making "appVersion" a prop as well seems reasonable to me

@varl
Copy link
Contributor

varl commented Oct 14, 2021

Implementation looks good to me, and the appVersion prop makes sense as well.

@Mohammer5 Mohammer5 marked this pull request as ready for review October 14, 2021 07:27
@Mohammer5 Mohammer5 requested review from varl and amcgee October 14, 2021 07:28
Copy link
Member

@amcgee amcgee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm... implementation looks good here. I'm not sure about making it a prop instead of using the @dhis2/app-service-config context to pass it in... As mentioned, when moving to a global shell we'll have to "subscribe" to the values which context lets us do. At that time we'll need to remove or deprecate the appName prop from the HeaderBar anyway (and also appVersion)

I think the main reason I'd like to make this available through useConfig, though, is that the application version (and maybe even name as well) could likely be useful in other application components... would it be a huge amount of additional effort to add it there? I'm not opposed to adding this for now, if it's a lot easier... being able to access the resolved application config could be quite useful I think.

@Mohammer5
Copy link
Contributor Author

Mohammer5 commented Nov 17, 2021

the application version (and maybe even name as well) could likely be useful in other application components

I think putting the information into useConfig and expecting these values as a prop are not mutually exclusive.

when moving to a global shell we'll have to "subscribe" to the values which context lets us do. At that time we'll need to remove or deprecate the appName prop from the HeaderBar anyway (and also appVersion)

I don't understand the reasoning here. From what I can tell, the global shell will always know which app and its version is being displayed (as it's the service responsible for replacing the app when navigating to a different one). Changing the prop would also cause the headerbar to rerender. Of course I'm making some assumptions here:

  • The headerbar is rendered by the global shell
  • The global shell knows about the app name and version

I think this boils down to a more fundamental aspect:
Should our components retrieve data by themselves or should data be provided (from a certain perspective: should they be controlled or uncontrolled)

I think in the end this is quite a subjective topic.. My experience makes me believe that controlled components are more robust/future-proof without having to anticipate the future (I can expand on why I think this way if you want; I guess this is the part where different developers have made different experiences in their career and therefore favor different approaches). With that in mind I guess using the useConfig wouldn't cause any harm, but I don't see the necessity to go that way as it's slightly (not a lot) more work with potential drawbacks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants