Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataviews filter: move resetValueOnSelect prop to combobox item #64852

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

ciampo
Copy link
Contributor

@ciampo ciampo commented Aug 27, 2024

What?

Move resetValueOnSelect from Ariakit.Combobox to Ariakit.ComboboxItem

Why?

The resetValueOnSelect prop on Ariakit.Combobox is deprecated since version 0.4.5.

How?

The suggested action is to simply apply it to Ariakit.ComboboxItem instead, which is what this PR does.

Testing Instructions

There shouldn't be any differences at runtime.

  • Apply the following diff
Click to expand
diff --git a/packages/dataviews/src/components/dataviews-filters/search-widget.tsx b/packages/dataviews/src/components/dataviews-filters/search-widget.tsx
index 1b369222b8..0cc04f39d6 100644
--- a/packages/dataviews/src/components/dataviews-filters/search-widget.tsx
+++ b/packages/dataviews/src/components/dataviews-filters/search-widget.tsx
@@ -304,6 +304,5 @@ function ComboboxList( { view, filter, onChangeView }: SearchWidgetProps ) {
 }
 
 export default function SearchWidget( props: SearchWidgetProps ) {
-	const Widget = props.filter.elements.length > 10 ? ComboboxList : ListBox;
-	return <Widget { ...props } />;
+	return <ComboboxList { ...props } />;
 }
  • Load the "pages" section in the site editor
  • Add an "Author" filter
  • Type "Ad", select the "Admin" item
  • Make sure that the characters that were typed are still there — ie. the input field was not reset.

Screenshots or screencast

Screenshot 2024-08-27 at 23 25 53

@ciampo ciampo requested review from oandregal, ntsekouras and a team August 27, 2024 21:31
@ciampo ciampo self-assigned this Aug 27, 2024
Copy link

github-actions bot commented Aug 27, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ciampo <[email protected]>
Co-authored-by: tyxla <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ciampo ciampo added [Type] Code Quality Issues or PRs that relate to code quality [Package] DataViews /packages/dataviews labels Aug 27, 2024
Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@ciampo ciampo merged commit d574952 into trunk Aug 28, 2024
68 of 71 checks passed
@ciampo ciampo deleted the fix/dataviews-filters-combobox-deprecated branch August 28, 2024 21:59
@github-actions github-actions bot added this to the Gutenberg 19.2 milestone Aug 28, 2024
bph pushed a commit to bph/gutenberg that referenced this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] DataViews /packages/dataviews [Type] Code Quality Issues or PRs that relate to code quality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants