flatlogic / react-material-admin

☄️React Material Admin is a React template built with Material-UI
https://flatlogic.com/admin-dashboards/react-material-admin/demo
MIT License
1.6k stars 559 forks source link

Problem In UserContext -> loginUser function #18

Closed Vn-ChemGio closed 4 years ago

Vn-ChemGio commented 4 years ago

As we know, In Login file, using React userState hook for controll and display UI in view

But in page, we using loginUser function, from UserContext

This function using 6 parameter userDispatch, loginValue, passwordValue, props.history, setIsLoading, setError Some of this is arror function to change some state in Login Component

But I think a problem in it: In "loginUser" function store in UserContext file When call loginUser => we make change some of that state (Ex: error, isLoading, userDispatch) this make warning render, because this work maybe Asynchronous ; so browser could not optimization for render And if setError(true) (before setIsLoading(false); or dispatch()) in loginUser this browser render will not display error messenger

michaeldaineka commented 4 years ago

Hi!

We fixed the problem. Thank you for help.

Best regards