Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(headless): undefined error when query suggestions adds a new face…
…t without values (#4257) https://coveord.atlassian.net/browse/KIT-3457 The steps for the bug to happen are here below. This bug only happens very rarely with a config. The config used for the commerce ssr sample happened to trigger it. 1. Facets are or are not in the state 2. `fetchQuerySuggestions.fulfilled` adds new facets without a proper ‘request.values’ attribute ([here](https://github.com/coveo/ui-kit/blob/87ef80c648225ce21b002282060958cef9556fc8/packages/headless/src/features/commerce/facets/facet-set/facet-set-slice.ts#L488)) 3. On a new search with ‘clearFilter’ we call `clearAllCoreFacets`, that action then tries a forEach on every request on every values ([here](https://github.com/coveo/ui-kit/blob/5730c4afa8eedca06ef4f83c019465d9264166c2/packages/headless/src/features/commerce/facets/facet-set/facet-set-slice.ts#L492)) 4. Crash Steps to reproduce: 1. checkout KIT-3457 2. Remove the line added here in the PR 3. npm run dev -w @coveo/headless-ssr-commerce-samples 5. query 'sd' 6. press 'Search' 7. add 's' to the query 8. press 'Search' --------- Co-authored-by: ylakhdar <ylakhdar@coveo.com> Co-authored-by: Frederic Beaudoin <fbeaudoin@coveo.com> Co-authored-by: Nico Labarre <Spuffynism@users.noreply.github.com>
- Loading branch information