File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,11 @@ RepoPage.propTypes = {
7373}
7474
7575function mapStateToProps ( state , ownProps ) {
76- const { login, name } = ownProps . params
76+ // We need to lower case the login/name due to the way GitHub's API behaves.
77+ // Have a look at ../middleware/api.js for more details.
78+ const login = ownProps . params . login . toLowerCase ( )
79+ const name = ownProps . params . name . toLowerCase ( )
80+
7781 const {
7882 pagination : { stargazersByRepo } ,
7983 entities : { users, repos }
Original file line number Diff line number Diff line change @@ -73,7 +73,10 @@ UserPage.propTypes = {
7373}
7474
7575function mapStateToProps ( state , ownProps ) {
76- const { login } = ownProps . params
76+ // We need to lower case the login due to the way GitHub's API behaves.
77+ // Have a look at ../middleware/api.js for more details.
78+ const login = ownProps . params . login . toLowerCase ( )
79+
7780 const {
7881 pagination : { starredByUser } ,
7982 entities : { users, repos }
Original file line number Diff line number Diff line change @@ -50,12 +50,17 @@ function callApi(endpoint, schema) {
5050
5151// Read more about Normalizr: https://github.com/gaearon/normalizr
5252
53+ // GitHub's API may return results with uppercase letters while the query
54+ // doesn't contain any. For example, "someuser" could result in "SomeUser"
55+ // leading to a frozen UI as it wouldn't find "someuser" in the entities.
56+ // That's why we're forcing lower cases down there.
57+
5358const userSchema = new Schema ( 'users' , {
54- idAttribute : ' login'
59+ idAttribute : user => user . login . toLowerCase ( )
5560} )
5661
5762const repoSchema = new Schema ( 'repos' , {
58- idAttribute : ' fullName'
63+ idAttribute : repo => repo . fullName . toLowerCase ( )
5964} )
6065
6166repoSchema . define ( {
You can’t perform that action at this time.
0 commit comments