Fixing Few Bugs in Utopian.io
I have worked on fixing two bugs in Utopian.io.
Issue #96 - Bug when navigating to a project page reported by @nathpaiement - Here in this when you navigate to the project page on the first click it does not work and the view remains same however the address bar changes. When you open the console you will get an error like cannot read property 'id' of null.
To fix this issue I need to add an extra parameter when we go through all the contributions as shown below. At first, we were checking if the projectId is present, but we need to check repository id as well.
if (match.params.projectId && contribution.json_metadata.repository.id)
Commit of the previous change: https://github.com/utopian-io/utopian.io/pull/105/commits/28b38ab1da5493c4bebf1971bf3ad9b1fc8fd055
Issue #12 - Search results disappear when scrolling to the bottom as shown below. In the inspect element you can see that we are querying a lot of times
To fix this issue we have to limit the API query to only up-to how many results we have. To fix this I have changed SearchFeed.js file to inlcude the below code
if(this.total !== 0 && this.total <= this.state.skip){
return;
}
Thus when the total results are less than the querying result, I am returning from there and not going to call the contributions again.
Commit of the change : https://github.com/utopian-io/utopian.io/pull/105/commits/7efb3ffb3f8bed9f8ecfdd205ae9cc4264bcbb46
Pull Requests : https://github.com/utopian-io/utopian.io/pull/105
Posted on Utopian.io - Rewarding Open Source Contributors