From 294b888b6f7ab2b9cfa6c40f5664586265fea689 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Thu, 15 Aug 2024 17:40:59 +0200 Subject: [PATCH] DataViews: Update: Sort descending button may be wrongly pressed. (#64547) Co-authored-by: jorgefilipecosta --- .../src/components/dataviews-view-config/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/dataviews/src/components/dataviews-view-config/index.tsx b/packages/dataviews/src/components/dataviews-view-config/index.tsx index 034f618aea00f..e396b1c68203c 100644 --- a/packages/dataviews/src/components/dataviews-view-config/index.tsx +++ b/packages/dataviews/src/components/dataviews-view-config/index.tsx @@ -143,6 +143,10 @@ function SortFieldControl() { function SortDirectionControl() { const { view, fields, onChangeView } = useContext( DataViewsContext ); + let value = view.sort?.direction; + if ( ! value && view.sort?.field ) { + value = 'desc'; + } return ( { if ( newDirection === 'asc' || newDirection === 'desc' ) { onChangeView( {