-
Notifications
You must be signed in to change notification settings - Fork 521
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
Conversation
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:
|
if (localInstantSearchInstance && widget.dependsOn === 'recommend') { | ||
localInstantSearchInstance._hasRecommendWidget = true; | ||
} else if (localInstantSearchInstance) { | ||
localInstantSearchInstance._hasSearchWidget = true; | ||
} else if (widget.dependsOn === 'recommend') { | ||
hasRecommendWidget = true; | ||
} else { | ||
hasSearchWidget = true; | ||
} | ||
}); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
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