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(queries): prevent network request #6205

Merged
merged 8 commits into from
May 21, 2024

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented May 16, 2024

Summary

In index and instantsearch, keep track of which type of widgets are used, and only send a request of the right type.

Result

If only recommend or search widgets are present, only that request is done.

This has slight further impact to ensure that a render still happens when only recommend returns results.

FX-2892

Copy link

codesandbox-ci bot commented May 16, 2024

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 cfe8d23:

Sandbox Source
react-instantsearch-app Configuration

@Haroenv Haroenv marked this pull request as ready for review May 17, 2024 10:29
Comment on lines +476 to +485
if (localInstantSearchInstance && widget.dependsOn === 'recommend') {
localInstantSearchInstance._hasRecommendWidget = true;
} else if (localInstantSearchInstance) {
localInstantSearchInstance._hasSearchWidget = true;
} else if (widget.dependsOn === 'recommend') {
hasRecommendWidget = true;
} else {
hasSearchWidget = true;
}
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the values be reset to false somewhere before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you don't know when another index still has widgets 🤔 in testing this seemed to repress the request though

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes I forgot about that. I'm fine with this then.

@dhayab dhayab merged commit 0154995 into feat/map-recommend-results May 21, 2024
8 checks passed
@dhayab dhayab deleted the fix/prevent-empty-request branch May 21, 2024 07:49
Haroenv added a commit that referenced this pull request May 21, 2024
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