feat(toolbar): add ais.index block support for index-scoped widgets#26
Open
sarahdayan wants to merge 3 commits intofeat/ais-index-block-supportfrom
Open
feat(toolbar): add ais.index block support for index-scoped widgets#26sarahdayan wants to merge 3 commits intofeat/ais-index-block-supportfrom
ais.index block support for index-scoped widgets#26sarahdayan wants to merge 3 commits intofeat/ais-index-block-supportfrom
Conversation
ais.index block support for index-scoped widgets
Index-dependent widgets (searchBox, configure, hits, etc.) need to be scoped to a search index. Rather than setting indexName on the InstantSearch instance, ais.index blocks wrap child widgets uniformly for both single-index and multi-index (federated search) scenarios. - Make block types recursive (blocks can contain nested blocks) - Extract processBlocks() for recursive block processing - Handle ais.index by creating an index widget and recursing into children - Validate indexName presence with warning on missing - Register cleanup for index widgets and injected style elements - Add indexId to ExperienceApiBlockParameters Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
6f94e8d to
2e4cd56
Compare
Add nested block UI, auto-wrapping logic, move-between-indices support, and AI tool updates for the new `ais.index` block type. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
8c2b720 to
82f34f0
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
82f34f0 to
8a3e775
Compare
2e4cd56 to
d12d03c
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds full toolbar support for
ais.indexblocks introduced in #25. Users can manage index-scoped widget hierarchies through both the manual UI and the AI assistant.Key changes:
ais.indexblocks (creates one if none exists, appends to the last one otherwise)BlockPath([parentIdx, childIdx]) instead of flat indicesIndexBlockGroupcomponent: grouped container showing index params + nested child widgets + scoped "Add Widget" button<select>dropdowntarget_indexvalidation,move_widgettool,parsePathhardening (rejects empty strings, negative indices, 3+ levels)AddBlockResultreturn type:onAddBlockreturns{ path, indexCreated }so the AI tool can prompt for index name without relying on stale React stateNote
No new widget was added (aside from
index). The preview images below used a dummysearchBoxwidget for manual tests, but this PR doesn't include it.Files changed
types.tsBlockPath,AddBlockResult, optionalcontainer,indexIdwidget-types.tsxais.indexentry,indexIndependentflag,columnsoptionapp.tsxonMoveBlock, helperspanel.tsxindex-block-group.tsxblock-card.tsxblock-editor.tsxcolumnsconfigadd-widget-popover.tsxfilterprop to excludeais.indexin scoped menusai/tools.tstarget_indexvalidation,move_widget,parsePathhardeningai/system-prompt.tsai-chat.tsxai-tools.test.tsPreview