-
Notifications
You must be signed in to change notification settings - Fork 553
feat(instantsearch.js): introduce autocomplete widget #6759
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
Conversation
|
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 bb9621b:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, just a minor comment.
| import { | ||
| connectAutocomplete, | ||
| connectSearchBox, | ||
| } from '../../connectors/index.umd'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this import correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it prevents us from importing the chat, so rollup can properly bundle the UMD package.
| type CreateAutocompletePropGettersParams = { | ||
| useEffect: (effect: () => void, inputs?: readonly unknown[]) => void; | ||
| useId: () => string; | ||
| useMemo: <TType>(factory: () => TType, inputs: readonly unknown[]) => TType; | ||
| useRef: <TType>(initialValue: TType | null) => { current: TType | null }; | ||
| useState: <TType>( | ||
| initialState: TType | ||
| ) => [TType, (newState: TType) => unknown]; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think in a future PR, we could move these into a shared file. I believe there are some parts of the chat widgets that could use this approach.
This PR (re-)introduces the
autocomplete()widget, with similar features to Algolia's standalone Autocomplete library.It includes a refactoring of the React implementation to extract the prop getters into a shared module and match the draft JS design in #6745.
FX-3548