@redneckz/wildless-cms-uni-blocks 0.14.844 → 0.14.845
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/bundle/bundle.umd.js +7 -6
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/services/search/useSearch.js +8 -5
- package/dist/services/search/useSearch.js.map +1 -1
- package/lib/services/search/useSearch.js +8 -5
- package/lib/services/search/useSearch.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +1 -1
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/services/search/useSearch.js +8 -5
- package/mobile/dist/services/search/useSearch.js.map +1 -1
- package/mobile/lib/services/search/useSearch.js +8 -5
- package/mobile/lib/services/search/useSearch.js.map +1 -1
- package/mobile/src/services/search/useSearch.ts +33 -22
- package/package.json +1 -1
- package/src/services/search/useSearch.ts +33 -22
package/bundle/bundle.umd.js
CHANGED
|
@@ -9577,12 +9577,13 @@
|
|
|
9577
9577
|
const SEARCH_INDEX_FILENAME = 'search.index.json';
|
|
9578
9578
|
const useSearch = ({ basePathList, initialQuery = '', }) => {
|
|
9579
9579
|
const [query, setQuery] = useState(initialQuery || '');
|
|
9580
|
+
const router = useRouter();
|
|
9580
9581
|
useEffect(() => {
|
|
9581
9582
|
if (initialQuery !== undefined && initialQuery !== null) {
|
|
9582
9583
|
setQuery(initialQuery);
|
|
9583
9584
|
}
|
|
9584
9585
|
}, [initialQuery]);
|
|
9585
|
-
const { data } = useAsyncData(basePathList?.length ? basePathList : null, fetchSearchIndex);
|
|
9586
|
+
const { data } = useAsyncData(basePathList?.length ? basePathList : null, fetchSearchIndex(router));
|
|
9586
9587
|
const [result, setResult] = useState(null);
|
|
9587
9588
|
useDebouncedEffect(() => {
|
|
9588
9589
|
if (data) {
|
|
@@ -9591,13 +9592,13 @@
|
|
|
9591
9592
|
}, [data, query]);
|
|
9592
9593
|
return [result, { value: query, onChange: setQuery }];
|
|
9593
9594
|
};
|
|
9594
|
-
const fetchSearchIndex = async (...basePathList) => (await Promise.allSettled(basePathList.map(async (basePath) => [
|
|
9595
|
+
const fetchSearchIndex = (router) => async (...basePathList) => (await Promise.allSettled(basePathList.map(async (basePath) => [
|
|
9595
9596
|
basePath,
|
|
9596
9597
|
await fetchJSON(joinPath(basePath, SEARCH_INDEX_FILENAME)),
|
|
9597
9598
|
])))
|
|
9598
9599
|
.map((_) => (_.status === 'fulfilled' ? _.value : []))
|
|
9599
|
-
.map(getSearchIndex);
|
|
9600
|
-
const getSearchIndex = ([basePath, result]) => {
|
|
9600
|
+
.map(getSearchIndex(router));
|
|
9601
|
+
const getSearchIndex = (router) => ([basePath, result]) => {
|
|
9601
9602
|
if (!result) {
|
|
9602
9603
|
return {};
|
|
9603
9604
|
}
|
|
@@ -9605,7 +9606,7 @@
|
|
|
9605
9606
|
...result,
|
|
9606
9607
|
corpus: result.corpus?.map((_) => ({
|
|
9607
9608
|
..._,
|
|
9608
|
-
uri: _.uri === 'index' ? basePath :
|
|
9609
|
+
uri: _.uri === 'index' ? basePath : adjustHref(router)(_.uri, basePath),
|
|
9609
9610
|
})),
|
|
9610
9611
|
};
|
|
9611
9612
|
};
|
|
@@ -11035,7 +11036,7 @@
|
|
|
11035
11036
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
11036
11037
|
});
|
|
11037
11038
|
|
|
11038
|
-
const packageVersion = "0.14.
|
|
11039
|
+
const packageVersion = "0.14.844";
|
|
11039
11040
|
|
|
11040
11041
|
exports.Blocks = Blocks;
|
|
11041
11042
|
exports.ContentPage = ContentPage;
|