Code Monkey home page Code Monkey logo

Comments (7)

gandhis1 avatar gandhis1 commented on September 21, 2024

Is an empty string a valid search term? What use case do you anticipate for this?

I made a specific change that was accepted a few months ago to do this because there did not appear to be a good reason to incur the search predicate cost across a potentially large number of nodes with an empty string. See #580

from react-dropdown-tree-select.

lennertVanSever avatar lennertVanSever commented on September 21, 2024

In my project, we use the searchPredicate function to build a custom async tree dropdown. Now our component is not working as expected when the input is cleared, we should be able to show all the options in that case but we can't.

from react-dropdown-tree-select.

gandhis1 avatar gandhis1 commented on September 21, 2024

In my project, we use the searchPredicate function to build a custom async tree dropdown. Now our component is not working as expected when the input is cleared, we should be able to show all the options in that case but we can't.

So the change I had made would not filter anything if search mode was off, which it was if the query was an empty string. That is, I would expect the default behavior with an empty string is to show all options.

Is this something you can create a code sandbox demonstrating?

from react-dropdown-tree-select.

lennertVanSever avatar lennertVanSever commented on September 21, 2024

Hi, I have a sandbox here with an example: https://codesandbox.io/s/blue-snowflake-jqt35v?file=/src/index.js

if the search term is empty, it is not reflected that way in the searchPredicate

from react-dropdown-tree-select.

mrchief avatar mrchief commented on September 21, 2024

searchPredicate was meant to return matches, so an empty string doesn't mean it matches all. That can be a business interpretation for a particular use case but baking that in, makes the control opinionated.

I like the idea of a separate function to notify when the search input is empty but I wonder why there are so many changed files. We need to verify if every snapshot is still the same, which at a glance appears to be so but again, I don't like the fact that avajs decided to change the render sequence throwing the git diff off.

from react-dropdown-tree-select.

lennertVanSever avatar lennertVanSever commented on September 21, 2024

Thanks for your response @mrchief. The many file changes are indeed related to the avajs. I only executed ava --update-snapshots so no idea what went wrong on that regard.

from react-dropdown-tree-select.

github-actions avatar github-actions commented on September 21, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

from react-dropdown-tree-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.