Skip to content

Commit

Permalink
Merge pull request #453 from yext/dev/merge-v1.6.1-9b282d9-into-develop
Browse files Browse the repository at this point in the history
Merge main (v1.6.1) into develop
  • Loading branch information
Fondryext authored Aug 13, 2024
2 parents 7f69cf9 + 00bb301 commit 290fc7c
Show file tree
Hide file tree
Showing 10 changed files with 38 additions and 30 deletions.
Binary file modified .storybook/snapshots/__snapshots__/mapboxmap--custom-pin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .storybook/snapshots/__snapshots__/mapboxmap--multiple-pins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified .storybook/snapshots/__snapshots__/mapboxmap--primary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions THIRD-PARTY-NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The following NPM package may be included in this product:

- @yext/search-headless-react@2.5.0-beta.3
- @yext/search-headless-react@2.5.0-beta.4

This package contains the following license and notice below:

Expand Down Expand Up @@ -1226,7 +1226,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The following NPM package may be included in this product:

- @yext/search-headless@2.6.0-beta.3
- @yext/search-headless@2.6.0-beta.4

This package contains the following license and notice below:

Expand Down
36 changes: 18 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@yext/search-ui-react",
"version": "1.7.0-beta.6",
"version": "1.7.0-beta.7",
"description": "A library of React Components for powering Yext Search integrations",
"author": "slapshot@yext.com",
"license": "BSD-3-Clause",
Expand Down Expand Up @@ -85,7 +85,7 @@
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"@yext/eslint-config-slapshot": "^0.5.0",
"@yext/search-headless-react": "^2.5.0-beta.3",
"@yext/search-headless-react": "^2.5.0-beta.4",
"axe-core": "^4.8.2",
"axe-playwright": "^1.2.3",
"babel-jest": "^29.7.0",
Expand All @@ -108,7 +108,7 @@
"util": "^0.12.5"
},
"peerDependencies": {
"@yext/search-headless-react": "^2.5.0-beta.3",
"@yext/search-headless-react": "^2.5.0-beta.4",
"react": "^16.14 || ^17 || ^18",
"react-dom": "^16.14 || ^17 || ^18"
},
Expand Down
1 change: 1 addition & 0 deletions src/components/Pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function Pagination(props: PaginationProps): JSX.Element | null {
const navigateToPage = useCallback((newPageNumber: number) => {
const newOffset = limit * (newPageNumber - 1);
searchActions.setOffset(newOffset);
searchActions.setIsPagination(true);
executeSearch(searchActions);
reportAnalyticsEvent(newPageNumber, currentPageNumber, maxPageCount);
}, [searchActions, limit, maxPageCount, currentPageNumber, reportAnalyticsEvent]);
Expand Down
19 changes: 12 additions & 7 deletions src/hooks/useSearchWithNearMeHandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,19 @@ export function useSearchWithNearMeHandling(
const searchActions = useSearchActions();

async function executeQuery() {
let intents: SearchIntent[] = [];
if (!searchActions.state.location.userLocation) {
if (!autocompletePromiseRef.current) {
autocompletePromiseRef.current = executeAutocomplete(searchActions);
try {
let intents: SearchIntent[] = [];
if (!searchActions.state.location.userLocation) {
if (!autocompletePromiseRef.current) {
autocompletePromiseRef.current = executeAutocomplete(searchActions);
}
const autocompleteResponseBeforeSearch = await autocompletePromiseRef.current;
intents = autocompleteResponseBeforeSearch?.inputIntents || [];
await updateLocationIfNeeded(searchActions, intents, geolocationOptions);
}
const autocompleteResponseBeforeSearch = await autocompletePromiseRef.current;
intents = autocompleteResponseBeforeSearch?.inputIntents || [];
await updateLocationIfNeeded(searchActions, intents, geolocationOptions);
} catch (e) {
console.error('Error executing autocomplete before search:', e);
await updateLocationIfNeeded(searchActions, [], geolocationOptions);
}
const verticalKey = searchActions.state.vertical.verticalKey ?? '';
const query = searchActions.state.query.input ?? '';
Expand Down
2 changes: 2 additions & 0 deletions tests/components/Pagination.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const mockedState: Partial<State> = {

const mockedActions = {
state: mockedState,
setIsPagination: jest.fn(),
setOffset: jest.fn(),
executeVerticalQuery: jest.fn()
};
Expand Down Expand Up @@ -157,6 +158,7 @@ describe('results are returned from search', () => {
// navigate to the last results page
await userEvent.click(screen.getByText(`${mockedResultsCount}`));
expect(actions.setOffset).toHaveBeenCalledWith(mockedResultsCount - 1);
expect(actions.setIsPagination).toHaveBeenCalledWith(true);
expect(actions.executeVerticalQuery).toHaveBeenCalledTimes(1);
});
});
Expand Down

0 comments on commit 290fc7c

Please sign in to comment.