Github Reports - Fixed default sort order

Fixed default sort order to match sortby dropdown
This commit is contained in:
Camerin Figueroa 2022-06-11 09:48:21 -04:00
parent 276631880b
commit 409111209e
2 changed files with 9 additions and 2 deletions

View File

@ -139,7 +139,14 @@ class GithubRepos extends React.Component {
}}>
{
this.sortOptions.map(option=>{
return <option value={option.value} key={option.value}>{option.text}</option>;
return (
<option
value={option.value}
key={option.value}
selected={option.value === this.props.sortedValue.value}
>
{option.text}
</option>);
})
}
</select>

View File

@ -1,4 +1,4 @@
let githubReducer = (state={repoLanguages: {}, page: 1, sortedValue: {value:'updated_at', asc:false}}, action) => {
let githubReducer = (state={repoLanguages: {}, page: 1, sortedValue: {value:'pushed_at', asc:false}}, action) => {
switch(action.type) {
case 'GET_REPOS':
return { ...state, repos: action.payload };