-
-
Notifications
You must be signed in to change notification settings - Fork 773
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
When adding roles to a user, the autosuggest control does not pass the current value to the UserService, instead it passes the previous value.
I traced it back to
/components/UserTable/UsersRoles/index.jsx - onRoleSelectorChanged
The following line does not seem to set keyword to the correct value even though item is the correct value.
this.setState({ roleSelectState: { roleId: -1, keyword: item } });
I believe the issue is because setState is async and batched, so state.roleSelectState is still the old value when getSuggestRoles() runs. This may be ale to be fixed using a callback.
this.setState(
{ roleSelectState: { roleId: -1, keyword: item } },
() => {
this.debounceGetSuggestRoles(); // now state is up to date
}
);
Also the values as you type do not match the list when the control loses focus.
Steps to reproduce?
- Go to Manage > Users.
- Click on a User's Role icon.
- Search for a role by name.
Current Behavior
No response
Expected Behavior
The suggested list of roles should match the current input not the previous value.
This is an issue for us because we have 2 character role names that don't display in the list because of all other matches. We have a role named "UT", but when you type this, it is really searching "U" which does not bring back "UT" because of all the "U" matches.
The workaround is to type an "x" at the end so that "UTX" is really searching "UT".
Relevant log output
Anything else?
Affected Versions
10.1.2 (latest v10 release)
What browsers are you seeing the problem on?
Chrome
Code of Conduct
- I agree to follow this project's Code of Conduct