[EuiI18n] Fixed EuiContext.i18n's mappingFunc not being called for EuiI18n with multiple tokens and function callbacks#5748
Merged
cee-chen merged 5 commits intoelastic:mainfrom Mar 28, 2022
Conversation
- the i18nMappingFunc wasn't being passed
- we need to add an extra branch for mappingFunc
cee-chen
commented
Mar 28, 2022
| // @ts-ignore TypeScript complains that `DEFAULT` doesn't have a call signature but we verified `renderable` is a function | ||
| return renderable(values); | ||
| const rendered = renderable(values); | ||
| return (i18nMappingFunc && typeof rendered === 'string' |
Contributor
Author
There was a problem hiding this comment.
@thompsongl You were totally right in #5743 (comment) about needing to check for a string type, the unit tests helped me confirm that it will error if the returned render is JSX.
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_5748/ |
chandlerprall
approved these changes
Mar 28, 2022
Contributor
chandlerprall
left a comment
There was a problem hiding this comment.
Great catch, fix, and tests! ❤️
Contributor
Author
|
Thanks y'all! |
This file contains hidden or 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
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.
Summary
I noticed this while attempting to QA #5743 with Babelfish checked in local dev.
Screencaps
Multiple tokens
Before
After
Function interpolation
Before
After
Checklist