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
User Profile translations - value put in correct field after search #28047
Conversation
c80da6e
to
c97e615
Compare
(attribute: UserProfileAttribute) => | ||
attribute.name === attributeToDelete, |
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.
This type is already inferrable, let's not add any additional type information if it's not needed.
(attribute: UserProfileAttribute) => | |
attribute.name === attributeToDelete, | |
(attribute) => attribute.name === attributeToDelete, |
)?.displayName; | ||
|
||
const formattedTranslationsToDelete = translationsToDelete?.substring( |
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.
Could you add a comment here with some explanation as to why we need to slice this string like this?
(attribute: UserProfileAttribute) => | ||
attribute.name !== attributeToDelete, |
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.
Same here, type can be inferred.
(attribute: UserProfileAttribute) => | |
attribute.name !== attributeToDelete, | |
(attribute) => attribute.name !== attributeToDelete, |
@@ -116,11 +116,32 @@ export const AddTranslationsDialog = ({ | |||
}, [combinedLocales, translationKey, setValue]); | |||
|
|||
const handleOk = () => { | |||
const formData = getValues(); | |||
onTranslationsAdded(formData); | |||
const formData = getValues() as Translations; |
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 like this compiles the same without a type-cast, so let's remove it.
const formData = getValues() as Translations; | |
const formData = getValues(); |
whoAmI.getLocale(), | ||
)} | ||
{filteredLocales.map((locale) => { | ||
const rowIndex = combinedLocales.findIndex( |
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.
Are you sure rowIndex
is always unique? It's being used as a key
here, which can lead to issues if not unique in this loop.
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 @jonkoops I have added the index
provided by the map(), and I'm using it as a fallback to ensure the uniqueness of the key
.
Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com>
Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com>
Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com>
c97e615
to
0a08a5c
Compare
…eycloak#28047) * fixed the issue of adding translation for searched locale Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * fixed the issue of adding translation for searched locale Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * small fix Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * renamed Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * fixed translation deleting on attribute deletion Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> * feedback Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> --------- Signed-off-by: Agnieszka Gancarczyk <agancarc@redhat.com> Co-authored-by: Agnieszka Gancarczyk <agancarc@redhat.com>
Closes #27838 and closes #28103