Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(removeHighlightTags): prevent destructuring undefined object #1039

Merged
merged 3 commits into from Aug 19, 2021

Conversation

shortcuts
Copy link
Member

@shortcuts shortcuts commented Aug 19, 2021

Summary

In case the indexing isn't optimal, an error is thrown as we are destructuring a possibly null lvl0.

Reproduction
This can happen when using DocSearch with a Netlify x Algolia Crawler index, but also with a DocSearch index: Search for ge in this sandbox

Solution

We now use getAttributeValueByPath to retrieve the attribute value, and fallback to an empty string if not found (alternatively, we could provide a default value such as Documentation).

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 19, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2673afc:

Sandbox Source
Vanilla Configuration
elegant-curie-76y18 PR

Co-authored-by: Haroen Viaene <hello@haroen.me>
@shortcuts shortcuts merged commit 6a6f7f6 into next Aug 19, 2021
@shortcuts shortcuts deleted the fix/removeHighlightTags branch August 19, 2021 16:19
@pixelastic
Copy link
Contributor

Thanks @Haroenv and @shortcuts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants