bradtraversy / proshop_mern

Shopping cart built with MERN & Redux
2k stars 1.18k forks source link

Redundant code to clear user list #106

Closed NicoPlyley closed 3 years ago

NicoPlyley commented 3 years ago

The USER_LIST_RESET is not needed. On the UserListScreen.js there is a useEffect that checks the state of userList. When it changes it will send you to the login screen, therefore an action does not have to be set at logout to clear the state of the user list.

aashiqahmed98 commented 3 years ago

No, it doesn't work like that, just now I saw.

aashiqahmed98 commented 3 years ago

@basir ,can close this issue!

NicoPlyley commented 3 years ago

I made it without the reset and it works perfectly fine as expected.

basir commented 3 years ago

the only place that we use USER_LIST_RESET is on logout: https://github.com/bradtraversy/proshop_mern/blob/master/frontend/src/actions/userActions.js#L73