Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Fixed select-search-field #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fixed select-search-field #19

wants to merge 1 commit into from

Conversation

EVCareeria
Copy link
Contributor

  • Some state flow changes
  • Allows searching of users
  • Allows picking of the current user through search

- Some state flow changes
- Allows searching of users
- Allows picking of the current user through search
Copy link
Contributor

@thejhh thejhh left a comment

Choose a reason for hiding this comment

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

Probably changes needed

if( searchField ) setSearchField('')
},
[
updateCurrentItemIndexCallback,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you set these as the dependency when they aren't used inside the callback?

Also why is there no dependency for searchField and setSearchField...

Also probably better would be to use setSearchField((value) => value ? value : '') -- that way you don't need the if clause or dependency for the current value, and it works asynchronously correctly (maybe).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This callback is only used to nullify the SearchField after user selects an item, so that full list of items can be seen afterwards.

Currently this is the only place where SearchField is emptied, if I set SearchField as dependency then the field nullifies itself everytime when someone starts typing, thus filtering doesn't work.

Ofcourse the Callback function itself is quite pointless in this case, the setSearchField could be called from functions that I use as dependency, but in that case the logic is spread around instead of getting called from one specific place.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants