Fix branch sorting (#80)

* Implement Branch item actions

* Implement Branch item actions

* Fix sorting
This commit is contained in:
Tan Nhu 2022-11-17 02:02:26 -08:00 committed by GitHub
parent 6d8c979e7c
commit 21eb0f61b6
2 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,6 @@ import type { CellProps, Column } from 'react-table'
import { Link, useHistory } from 'react-router-dom'
import cx from 'classnames'
import Keywords from 'react-keywords'
import { orderBy } from 'lodash-es'
import { useMutate } from 'restful-react'
import { String, useStrings } from 'framework/strings'
import { useAppContext } from 'AppContext'
@ -136,7 +135,7 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel
}
}
],
[getString, repoMetadata.defaultBranch, repoMetadata.path, routes, searchTerm, history]
[getString, repoMetadata.defaultBranch, repoMetadata.path, routes, searchTerm, history, onDeleteSuccess]
)
return (
@ -144,7 +143,7 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel
<Table<RepoBranch>
className={css.table}
columns={columns}
data={orderBy(branches || [], [searchTerm ? '' : 'commit.author.when'], ['desc'])}
data={branches || []}
getRowClassName={row => cx(css.row, (row.index + 1) % 2 ? css.odd : '')}
/>
</Container>

View File

@ -26,6 +26,7 @@ export function RepositoryBranchesContent({ repoMetadata }: Pick<GitInfoProps, '
queryParams: {
per_page: LIST_FETCHING_PER_PAGE,
page: pageIndex + 1,
sort: 'date',
direction: 'desc',
include_commit: true,
query: searchTerm