Skip to content

Comments

feat(toolbar): add ais.index block support for index-scoped widgets#26

Open
sarahdayan wants to merge 3 commits intofeat/ais-index-block-supportfrom
feat/ais-index-toolbar
Open

feat(toolbar): add ais.index block support for index-scoped widgets#26
sarahdayan wants to merge 3 commits intofeat/ais-index-block-supportfrom
feat/ais-index-toolbar

Conversation

@sarahdayan
Copy link
Member

@sarahdayan sarahdayan commented Feb 21, 2026

Summary

Adds full toolbar support for ais.index blocks introduced in #25. Users can manage index-scoped widget hierarchies through both the manual UI and the AI assistant.

Key changes:

  • Auto-wrapping: index-dependent widgets are automatically placed inside ais.index blocks (creates one if none exists, appends to the last one otherwise)
  • Path-based addressing: all state callbacks use BlockPath ([parentIdx, childIdx]) instead of flat indices
  • New IndexBlockGroup component: grouped container showing index params + nested child widgets + scoped "Add Widget" button
  • Move between indices: child widgets can be moved between index blocks via a <select> dropdown
  • AI tools updated: path-based addressing, target_index validation, move_widget tool, parsePath hardening (rejects empty strings, negative indices, 3+ levels)
  • AddBlockResult return type: onAddBlock returns { path, indexCreated } so the AI tool can prompt for index name without relying on stale React state

Note

No new widget was added (aside from index). The preview images below used a dummy searchBox widget for manual tests, but this PR doesn't include it.

Files changed

File What
types.ts BlockPath, AddBlockResult, optional container, indexId
widget-types.tsx ais.index entry, indexIndependent flag, columns option
app.tsx Auto-wrap logic, path-based callbacks, onMoveBlock, helpers
panel.tsx Nested rendering, widget count, expand/collapse state machine
index-block-group.tsx New — grouped container for index blocks
block-card.tsx Index selector for moving widgets, label accessibility fix
block-editor.tsx CSS grid layout via columns config
add-widget-popover.tsx filter prop to exclude ais.index in scoped menus
ai/tools.ts Path addressing, target_index validation, move_widget, parsePath hardening
ai/system-prompt.ts Conciseness guidance
ai-chat.tsx Updated prop types
ai-tools.test.ts 11 new tests (44 → 55)

Preview

Capture d’écran 2026-02-21 à 11 21 52 Capture d’écran 2026-02-21 à 11 22 26

@sarahdayan sarahdayan changed the title feat(toolbar): add ais.index block support for index-scoped widgets feat(toolbar): add ais.index block support for index-scoped widgets Feb 21, 2026
@sarahdayan sarahdayan added the Priority PR PRs that should be reviewed early because other work depends on them label Feb 21, 2026
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>
@sarahdayan sarahdayan force-pushed the feat/ais-index-block-support branch from 6f94e8d to 2e4cd56 Compare February 21, 2026 12:19
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>
@sarahdayan sarahdayan force-pushed the feat/ais-index-toolbar branch from 8c2b720 to 82f34f0 Compare February 21, 2026 12:58
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sarahdayan sarahdayan force-pushed the feat/ais-index-toolbar branch from 82f34f0 to 8a3e775 Compare February 21, 2026 13:02
@sarahdayan sarahdayan force-pushed the feat/ais-index-block-support branch from 2e4cd56 to d12d03c Compare February 21, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority PR PRs that should be reviewed early because other work depends on them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant