FullstackAcademy / boilermaker

Code scaffold for projects

Home Page:https://www.youtube.com/watch?v=7bLSuTHH4Ag&list=PLx0iOsdUOUmn7D5XL4mRUftn8hvAJGs8H

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React or other unrelated errors can log out user unexpectedly

glebec opened this issue · comments

Because this line is used as an error handler during login, if an error occurs earlier up the chain, the user will be logged out. However, earlier in the chain includes a vanilla dispatch which triggers React rendering and other unrelated code. Therefore, a mistake in an unrelated portion of the app (e.g. trying to display user && user.name.error.oops can cause the user to be immediately logged out, unnecessarily (and confusingly).

The fix is fairly simple, and is a nice example of when you want an intermediary non-catch error handler.