-
Notifications
You must be signed in to change notification settings - Fork 208
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) Add better support for loading multiple namespaces at once #1132
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ibacher
force-pushed
the
fix/better-support-for-multiple-namespaces
branch
from
August 30, 2024 19:17
61d20e5
to
f305937
Compare
Size Change: -90.3 kB (-1.56%) Total Size: 5.71 MB
ℹ️ View Unchanged
|
denniskigen
approved these changes
Aug 30, 2024
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.
Thanks, @ibacher. Lets see how this goes.
At least locally, this fixed the issue, so 🤞. |
This was referenced Sep 6, 2024
Merged
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Requirements
feat
,fix
, orchore
, among others). See existing PR titles for inspiration.For changes to apps
If applicable
Summary
This is a follow-up for #1119 that addresses a very narrow issue. Specifically, with #1119, when we loaded a namespace for an extension instance in a slot, this resulted in the namespace for the app itself not yet being populated. Basically, we would populate a namespace like
@openmrs/esm-login-app___location-picker___location-picker
correctly, but leave the@openmrs/esm-login-app
namespace unpopulated. Since we generally rely on theuseTranslation()
to actually load the namespace, this meant there were some circumstances (like using thetranslateFrom()
function) where the namespace for a specific extension instance was loaded but the namespace for the module was not currently registered, andi18next
had no idea that it should try the longer namespace name.This addresses this issue by ensuring that when we populate the namespace for an extension instance, we also populate the namespace for the app itself.
Screenshots
Related Issue
Other
Unsolved by this PR is the issue where
translateFrom()
cannot guarantee that a namespace is actually loaded, and so it may not correctly translate given translation keys under circumstances where the module hasn't otherwise been loaded first. While this sounds narrow, it remains a live possibility. I have added a note about this to the docs fortranslateFrom()
.