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: rawContent was not correctly cloned (hence undefined) #6549

Merged
merged 2 commits into from
Jan 28, 2025

Conversation

e-krebs
Copy link
Contributor

@e-krebs e-krebs commented Jan 28, 2025

Summary

Fixing an error made in #6544, where using Object.create(content) resulted in rawContent always being an empty object and the final _rawContent property always being undefined.
Now using a custom method to smartly clone content without the results property, which behaves correctly.

This approach avoids the need to delete the results property as it "just" creates a new object without it in the first place.
This result in a more performant approach than using the existing merge util + deleting the results property afterward.

Result

_rawContent as retrieved in the below example is now not always undefined anymore.

const { results: { _rawContent } } = useInstantSearch();

@e-krebs e-krebs self-assigned this Jan 28, 2025
Copy link

codesandbox-ci bot commented Jan 28, 2025

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 07f159c:

Sandbox Source
example-instantsearch-getting-started Configuration
example-react-instantsearch-getting-started Configuration
example-react-instantsearch-next-app-dir-example Configuration

@e-krebs e-krebs marked this pull request as ready for review January 28, 2025 10:57
@e-krebs e-krebs requested a review from Haroenv January 28, 2025 10:57
@Haroenv Haroenv enabled auto-merge (squash) January 28, 2025 11:39
@Haroenv Haroenv merged commit 0b2d4af into master Jan 28, 2025
14 checks passed
@Haroenv Haroenv deleted the fix/raw-content branch January 28, 2025 11:42
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.

2 participants