-
Notifications
You must be signed in to change notification settings - Fork 552
feat(index): introduce "isolated" option #6681
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
Conversation
An isolated index does not get requested when changes happen in the parent and also does not inherit its search parameters. If you want an isolated index to search, you need to cause a search (eg by refining a child widget) isolated indices: - do not automatically search when mounted - do not show up in ui state - do not interact with onStateChange - do not get requested in server-side rendering - do not cause searches in parent indices This option is EXPERIMENTAL, and implementation details may change in the future. Things that could change are: - which widgets get rendered when a change happens - whether the index searches automatically - whether the index is included in the URL / UiState - whether the index is include in server-side rendering Usage: ```js search.addWidgets([ index({ isolated: true, indexName: 'alone' }) ]); search.addWidgets([ index({ isolated: false }).addWidgets([ index({ indexName: 'isolated' }) ]), ]); ``` [FX-3448] supersedes the following POCs: - closes #6880 - closes #5939
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.
Pull Request Overview
This PR introduces an experimental "isolated" option for the index widget that allows indices to operate independently from their parent context. Isolated indices do not automatically search when mounted, are excluded from UI state, don't interact with onStateChange, and don't get requested in server-side rendering.
Key changes:
- Modified IndexWidgetParams type to support optional
isolated
configuration with union types - Implemented isolation logic affecting search behavior, parent relationships, and UI state inclusion
- Added comprehensive test coverage for isolated index functionality
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
packages/instantsearch.js/src/widgets/index/index.ts | Core implementation of isolated index functionality including type definitions, search behavior modifications, and parent relationship handling |
packages/instantsearch.js/src/widgets/index/tests/index-test.ts | Comprehensive test suite covering isolated index behavior, UI state exclusion, and search triggering scenarios |
packages/instantsearch.js/src/lib/InstantSearch.ts | Updated composition client validation to exclude isolated indices from the restriction |
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 30c6736:
|
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.
Awesome addition 👏
An isolated index does not get requested when changes happen in the parent and also does not inherit its search parameters.
If you want an isolated index to search, you need to cause a search (eg by refining a child widget)
isolated indices:
This option is EXPERIMENTAL, and implementation details may change in the future. Things that could change are:
Usage:
FX-3448
supersedes the following POCs: