maryvilledev / codesplainUI

Web app for breaking down and annotating Python 3 source code.
https://www.codesplain.io
GNU General Public License v3.0
2 stars 2 forks source link

Move user data from cookies to redux #473

Closed Hopding closed 7 years ago

Hopding commented 7 years ago

Description

This PR moves the storage location of certain user data (such as their username, avatarURL, & orgs) from cookies to the redux state. This resolves the problems we have had with stale data, as it causes the data to be updated every time the UI is loaded. The only data that is being stored in a cookie, now, is the user's token (and the signInState & signInRedirect). The <CodesplainAppBar /> component is in charge of loading the token cookie and updating the redux state with the user's info for use by the other components.

Motivation and Context

Fixes #447. Prior to this change, we already held some of this information in redux, but not all of it, and we still kept the data in the cookies as well. This resulted in problems with stale data, as certain information (e.g. the user's organizations) was only updated when they logged in.

Checklist:

dane-johnson commented 7 years ago

This PR has a lot in common with #464. Is there functionality added here that is not there?

Hopding commented 7 years ago

@dane-johnson It does. #464 does not remove the app's usage of cookies for storing user data. This PR goes. Look specifically at the changes made to components/Auth.jsx and containers/CodesplainAppBar.jsx.