Update powerlevel/role when the user changes in the user info panel (#7099)

This commit is contained in:
Šimon Brandner 2021-11-09 10:25:47 +01:00 committed by GitHub
parent 06e1f8ce85
commit 6cae176857
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1122,6 +1122,10 @@ const PowerLevelEditor: React.FC<{
const cli = useContext(MatrixClientContext);
const [selectedPowerLevel, setSelectedPowerLevel] = useState(user.powerLevel);
useEffect(() => {
setSelectedPowerLevel(user.powerLevel);
}, [user]);
const onPowerChange = useCallback(async (powerLevel: number) => {
setSelectedPowerLevel(powerLevel);