Skip to content

Commit

Permalink
DataViews: Update: Sort descending button may be wrongly pressed. (#6…
Browse files Browse the repository at this point in the history
…4547)

Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>
  • Loading branch information
jorgefilipecosta and jorgefilipecosta committed Aug 15, 2024
1 parent 8bcd5f0 commit 294b888
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,18 @@ function SortFieldControl() {

function SortDirectionControl() {
const { view, fields, onChangeView } = useContext( DataViewsContext );
let value = view.sort?.direction;
if ( ! value && view.sort?.field ) {
value = 'desc';
}
return (
<ToggleGroupControl
className="dataviews-view-config__sort-direction"
__nextHasNoMarginBottom
__next40pxDefaultSize
isBlock
label={ __( 'Order' ) }
value={ view.sort?.direction || 'desc' }
value={ value }
onChange={ ( newDirection ) => {
if ( newDirection === 'asc' || newDirection === 'desc' ) {
onChangeView( {
Expand Down

1 comment on commit 294b888

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 294b888.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10406453555
📝 Reported issues:

Please sign in to comment.