ublo-lib 1.47.99 → 1.47.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/common/components/search-bar/hooks/use-debounced-search.d.ts.map +1 -1
- package/es/common/components/search-bar/hooks/use-debounced-search.js +3 -1
- package/es/common/components/search-bar/hooks/use-search.d.ts.map +1 -1
- package/es/common/components/search-bar/hooks/use-search.js +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-debounced-search.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/search-bar/hooks/use-debounced-search.js"],"names":[],"mappings":"AAOA;;;;
|
|
1
|
+
{"version":3,"file":"use-debounced-search.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/search-bar/hooks/use-debounced-search.js"],"names":[],"mappings":"AAOA;;;;EAaC;uBApBsB,OAAO"}
|
|
@@ -6,6 +6,8 @@ const DEBOUNCE_AMOUNT = 600;
|
|
|
6
6
|
export default function useDebouncedSearch(searchFunction) {
|
|
7
7
|
const [text, setText] = React.useState("");
|
|
8
8
|
const debouncedSearchFunction = useConstant(() => debouncePromise(searchFunction, DEBOUNCE_AMOUNT));
|
|
9
|
-
const search = useAsync(async () =>
|
|
9
|
+
const search = useAsync(async () => {
|
|
10
|
+
return text.length === 0 ? undefined : debouncedSearchFunction(text);
|
|
11
|
+
}, [debouncedSearchFunction, text], { setLoading: (state) => ({ ...state, loading: true }) });
|
|
10
12
|
return { text, setText, search };
|
|
11
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-search.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/search-bar/hooks/use-search.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-search.d.ts","sourceRoot":"","sources":["../../../../../src/common/components/search-bar/hooks/use-search.js"],"names":[],"mappings":"AAIA;;;;;;;;;;EAYC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import useDebouncedSearch from "./use-debounced-search";
|
|
2
2
|
import { fetchResults } from "../utils/fetcher";
|
|
3
|
+
import { sendEvent } from "../../../../future/components/event-analytics/instant-search";
|
|
3
4
|
export default function useSearch({ ubloApi, site, lang, seo, exclude }) {
|
|
4
5
|
return useDebouncedSearch(async (query) => {
|
|
5
6
|
return fetchResults(ubloApi, site, lang, query, seo, exclude).then((res) => {
|