-
Notifications
You must be signed in to change notification settings - Fork 386
feat(voice): add additionalQueryParameters #2366
Conversation
Deploy preview for react-instantsearch ready! Built with commit 4d8488d https://deploy-preview-2366--react-instantsearch.netlify.com |
packages/react-instantsearch-dom/src/components/VoiceSearch.tsx
Outdated
Show resolved
Hide resolved
packages/react-instantsearch-dom/src/components/VoiceSearch.tsx
Outdated
Show resolved
Hide resolved
4d8488d
to
5d4904a
Compare
5d4904a
to
a296742
Compare
a296742
to
e79488a
Compare
Two new props: - `additionalQueryParameters: () => Partial<SearchParameters>` (only applied when voice search is mounted) - `language: string` (iso 639-1), the parameter sent to Algolia will be always the short version known limitation: additional query parameters will stay applied as long as the Voice Search widget is mounted, meaning they can cause stale values if you switch input method without unmounting (limitation of the architecture of React InstantSearch) This does not have additional tests yet. The connector is written in JS instead of TS, because it's mostly copy-pasted from searchBox, and that would be needless extra work otherwise #hackathon Co-Authored-By: Haroenv <haroen@algolia.com>
e79488a
to
8983f7a
Compare
packages/react-instantsearch-core/src/connectors/connectVoiceSearch.js
Outdated
Show resolved
Hide resolved
@Haroenv could you review the recent commits? |
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 ready to me now @eunjae-lee, just maybe tests for multi-index (as far as I can tell it will just work)
added some tests for multi index 349b03e |
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.
Would it also be possible to do the connector in TypeScript?
packages/react-instantsearch-core/src/connectors/connectVoiceSearch.js
Outdated
Show resolved
Hide resolved
I wrote this in the original description, but since it's mostly the same as search box, and the patterns for connectors aren't yet clear in React InstantSearch, I didn't do this in this PR |
* feat(voice): add additionalQueryParameters Two new props: - `additionalQueryParameters: () => Partial<SearchParameters>` (only applied when voice search is mounted) - `language: string` (iso 639-1), the parameter sent to Algolia will be always the short version known limitation: additional query parameters will stay applied as long as the Voice Search widget is mounted, meaning they can cause stale values if you switch input method without unmounting (limitation of the architecture of React InstantSearch) This does not have additional tests yet. The connector is written in JS instead of TS, because it's mostly copy-pasted from searchBox, and that would be needless extra work otherwise #hackathon Co-Authored-By: Haroenv <haroen@algolia.com> * chore(size): update bundle size (this change is +270b) * feat(voice): handle language and additionalQueryParameters separately * feat(voice): add tests * feat(voice): add tests for multi index * feat(voice): add test for additionalVoiceParameters * chore: remove unused argument
accidentally merged into next instead of master, but fixed in 3a45b2c |
# [6.1.0](v6.0.0...v6.1.0) (2019-12-17) ### Bug Fixes * **connectNumericMenu:** support numeric refinement 0 ([#2882](#2882)) ([30bd9fd](30bd9fd)) * **deps:** update dependency next to v9.1.1 ([9d49d33](9d49d33)) * **helper:** rely on stable version of algoliasearch-helper ([#2871](#2871)) ([e3531a1](e3531a1)) ### Features * **insights:** show an error when 'clickAnalytics: true' is missing. ([#2877](#2877)) ([621656a](621656a)) * **voice:** add additionalQueryParameters ([#2366](#2366)) ([3a45b2c](3a45b2c))
Two new props:
additionalQueryParameters: () => Partial<SearchParameters>
(only applied when voice search is mounted)language: string
(iso 639-1), the parameter sent to Algolia will be always the short versionNew connector:
connectVoiceSearch
known limitation: additional query parameters will stay applied as long as the Voice Search widget is mounted, meaning they can cause stale values if you switch input method without unmounting (limitation of the architecture of React InstantSearch)
The connector is written in JS instead of TS, because it's mostly copy-pasted from searchBox, and that would be needless extra work otherwise #hackathon
fixes #2874