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

FIX (searchFn)[#101] searchFn callback should only call once when typing in the search bar #131

Merged
merged 9 commits into from
Oct 20, 2020

Conversation

pattiereaves
Copy link
Contributor

  • Add searchResults array to the component state so that we can store the calculation and prevent it from being executed multiple times.
  • Adds example documentation for how to add a custom searchFn.

resolves #101

@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 18, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2bb3dab:

Sandbox Source
react-dropdown-select Configuration
searchFn callback issue Issue #101

@pattiereaves pattiereaves changed the title Fix (searchFn)[#101] searchFn callback should only call once when typing in the search bar FIX (searchFn)[#101] searchFn callback should only call once when typing in the search bar Oct 18, 2020
@pattiereaves
Copy link
Contributor Author

Would you be willing to add the hacktoberfest label to this project?

@sanusart sanusart added the hacktoberfest-accepted PRs sent by hacktoberfest participants label Oct 19, 2020
@@ -1,5 +1,6 @@
import React from 'react';
import TestRenderer from 'react-test-renderer';
import { LIB_NAME } from '../src/constants';
Copy link
Owner

Choose a reason for hiding this comment

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

Not used I think

@@ -74,7 +74,8 @@ export class Select extends Component {
values: props.values,
search: '',
selectBounds: {},
cursor: null
cursor: null,
searchResults: props.options,
Copy link
Owner

Choose a reason for hiding this comment

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

Can you please add the new state entry to docs at /docs/src/pages/state.md?

src/index.js Outdated
@@ -379,6 +382,7 @@ export class Select extends Component {
});

handleKeyDown = (event) => {
console.log({ event });
Copy link
Owner

Choose a reason for hiding this comment

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

Not needed anymore I believe.

@pattiereaves pattiereaves requested a review from sanusart October 19, 2020 22:08
Copy link
Owner

@sanusart sanusart left a comment

Choose a reason for hiding this comment

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

@pattiereaves thank you!

@sanusart sanusart merged commit 12164f9 into sanusart:master Oct 20, 2020
sanusart added a commit that referenced this pull request Oct 29, 2020
…when typing in the search bar (#131)"

This reverts commit 12164f9.
sanusart added a commit that referenced this pull request Oct 29, 2020
…when typing in the search bar (#131)" (#135)

This reverts commit 12164f9.
sanusart added a commit that referenced this pull request Nov 29, 2020
* master: (27 commits)
  v4.7.0 See changelog: https://github.com/sanusart/react-dropdown-select/blob/master/CHANGELOG.md
  FIX (searchFn)[#101] searchFn callback should only call once when typing in the search bar, #134, #133 (#136)
  4.6.1
  Revert "FIX (searchFn)[#101] searchFn callback should only call once when typing in the search bar (#131)" (#135)
  v4.6.0 See changelog: https://github.com/sanusart/react-dropdown-select/blob/master/CHANGELOG.md
  FIX (searchFn)[#101] searchFn callback should only call once when typing in the search bar (#131)
  v4.5.2 See changelog: https://github.com/sanusart/react-dropdown-select/blob/master/CHANGELOG.md
  FIX (style): Accepts a short color (#127)
  v4.5.1 See changelog: https://github.com/sanusart/react-dropdown-select/blob/master/CHANGELOG.md
  FIX (duplicates)[#116]: more proper way to check dupes, closes #116
  FIX (duplicates): PR comments
  FIX (duplicates)[#116]: more proper way to check dupes, closes #116
  bump version
  v4.5.0 See changelog: https://github.com/sanusart/react-dropdown-select/blob/master/CHANGELOG.md
  FIX (input) [#114]: fix chars truncated, closes #114
  v4.4.2 See changelog: https://github.com/sanusart/react-dropdown-select/blob/master/CHANGELOG.md
  FIX (box-model): add box-sizing border-box, closes #94 (#104)
  Bump websocket-extensions from 0.1.3 to 0.1.4 (#102)
  DOCS (example): add import to example, thanks to @karland, closes #93
  CHORE (types): fix keepOpen type | closes #95 (#96)
  ...

# Conflicts:
#	__tests__/__snapshots__/index.spec.js.snap
#	__tests__/components/__snapshots__/DropdownHandle.spec.js.snap
#	package-lock.json
#	src/components/DropdownHandle.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted PRs sent by hacktoberfest participants
Projects
None yet
Development

Successfully merging this pull request may close these issues.

searchFn callback fires twice when typing in search bar
2 participants