This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
feat(DerivedHelper): skip request for empty index #938
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
We currently don't introspect, but if the indexName is empty, the search client will return an error, meaning skipping those queries isn't really a breaking change. Skipping those queries can be interesting to create patterns like "multiple sibling indices at root of instantsearch" and "orphan indices". (still WIP as I didn't add a test for this yet)
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 07e8671:
|
Haroenv
added a commit
to algolia/instantsearch
that referenced
this pull request
Apr 12, 2023
requires algolia/algoliasearch-helper-js#938 Essentially this allows us to create neat non-inheriting indices like this with only three queries sent: ```jsx const App = ( <InstantSearch> <Index indexName="1" indexId="1a" /> <Index indexName="1" indexId="1b" /> <Index indexName="2" /> </InstantSearch> ); ``` Combined with algolia/react-instantsearch#3690 again, you could also create ```jsx // 🚨 this isn't possible yet const App = ( <InstantSearch> <Index indexName="1"> {/* other widgets, causing no results */} <NoResults> <Index indexName="1" parentIndexId={null}> {/* display stuff from a separate query, without interference of inheritance */} </Index> </NoResults> </Index> </InstantSearch> ); ```
Haroenv
added a commit
to algolia/instantsearch
that referenced
this pull request
Apr 26, 2023
requires algolia/algoliasearch-helper-js#938 Essentially this allows us to create neat non-inheriting indices like this with only three queries sent: ```jsx const App = ( <InstantSearch> <Index indexName="1" indexId="1a" /> <Index indexName="1" indexId="1b" /> <Index indexName="2" /> </InstantSearch> ); ``` Combined with algolia/react-instantsearch#3690 again, you could also create ```jsx // 🚨 this isn't possible yet const App = ( <InstantSearch> <Index indexName="1"> {/* other widgets, causing no results */} <NoResults> <Index indexName="1" parentIndexId={null}> {/* display stuff from a separate query, without interference of inheritance */} </Index> </NoResults> </Index> </InstantSearch> ); ```
Haroenv
requested review from
a team,
dhayab and
sarahdayan
and removed request for
a team
April 27, 2023 08:36
dhayab
approved these changes
Apr 27, 2023
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.
Great!
Haroenv
added a commit
that referenced
this pull request
May 3, 2023
dhayab
pushed a commit
to algolia/instantsearch
that referenced
this pull request
Jul 10, 2023
dhayab
pushed a commit
to algolia/instantsearch
that referenced
this pull request
Jul 10, 2023
* chore: delete renovate (algolia/algoliasearch-helper-js#936) algolia/algoliasearch-helper-js@c580f8d * feat(DerivedHelper): skip request for empty index (algolia/algoliasearch-helper-js#938) algolia/algoliasearch-helper-js@653b2e5
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We currently don't introspect, but if the indexName is empty, the search client will return an error, meaning skipping those queries isn't really a breaking change.
If no queries would be triggered at all, client.search is also not called.
Skipping those queries can be interesting to create patterns like "multiple sibling indices at root of instantsearch" and "orphan indices".