Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion js/apps/admin-ui/src/user/EditUser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ const EditUserForm = ({ user, bruteForced, refresh }: EditUserFormProps) => {
const attributes =
"key" in (formUser.attributes?.[0] || [])
? keyValueToArray(formUser.attributes as KeyValueType[])
: user.attributes;
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this has been added with some intent to fix a bug, but I could be wrong. Just to be sure, have you tried the following:

  • Add a couple of attributes to a user and save.
  • Reload the page and change some other field, leaving the attributes, then save the user.
  • Reload the page again and save the attributes.

I feel like perhaps if the attributes are left untouched their value in the form might be left empty, hence the fallback to the initial value of the user attributes.

Copy link
Contributor Author

@agagancarczyk agagancarczyk Aug 24, 2023

Choose a reason for hiding this comment

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

Thanks @jonkoops I hear what you are saying. I had a similar impression after seeing @edewit commit from 2 weeks ago fixing some bug on the same line of code.

I have now double-checked my fix and it's working as expected for all the scenarios you have outlined above. It's now behaving the way it should.

@edewit can I get your review as well (just in case we are missing something)? Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Perfect, thanks for verifying this!

: [];
try {
await adminClient.users.update(
{ id: user.id! },
Expand Down