Conversation
Adds a separate chat trigger widget, and give a warning if you don't use it, ai mode or inline layout
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 15 |
| Duplication | -1 |
TIP This summary will be updated as you push new changes. Give us feedback
More templates
algoliasearch-helper
instantsearch-ui-components
instantsearch.css
instantsearch.js
react-instantsearch
react-instantsearch-core
react-instantsearch-nextjs
react-instantsearch-router-nextjs
vue-instantsearch
commit: |
There was a problem hiding this comment.
Pull request overview
This PR splits the “open chat” entry point out of the Chat UI into a dedicated chatTrigger widget/component, and adds runtime validation to ensure the Chat widget has a configured way to open (via chatTrigger, AI-mode inputs, or opting out).
Changes:
- Introduces
chatTriggeracross InstantSearch.js + React InstantSearch (+ auseChatTriggerconnector) and updates exports. - Adds entry-point validation in
connectChatand propagatesopensChatfrom AI-mode input widgets. - Refactors tests and shared UI types to accommodate removal of the built-in toggle button.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/common/widgets/chat/utils.ts | Switches test “open chat” helper from DOM click to a global setter hook |
| tests/common/widgets/chat/index.ts | Resets the global setter hook between tests |
| packages/react-instantsearch/src/widgets/SearchBox.tsx | Marks AI-mode search box as an entry point (opensChat) |
| packages/react-instantsearch/src/widgets/index.ts | Exports new ChatTrigger component |
| packages/react-instantsearch/src/widgets/ChatTrigger.tsx | Adds React ChatTrigger component and registers presence via useChatTrigger |
| packages/react-instantsearch/src/widgets/Chat.tsx | Removes toggle-button wiring; adds disableTriggerValidation plumbing + getOpen handle |
| packages/react-instantsearch/src/widgets/Autocomplete.tsx | Marks AI-mode autocomplete as an entry point (opensChat) |
| packages/react-instantsearch/src/widgets/tests/utils/all-widgets.tsx | Disables trigger validation for widget catalog tests |
| packages/react-instantsearch/src/tests/common-widgets.test.tsx | Wires chat ref for tests via global setter hook |
| packages/react-instantsearch-core/src/index.ts | Exports useChatTrigger |
| packages/react-instantsearch-core/src/connectors/useChatTrigger.ts | Adds useChatTrigger connector wrapper |
| packages/instantsearch.js/src/widgets/search-box/search-box.tsx | Marks AI-mode SearchBox widget as an entry point (opensChat) |
| packages/instantsearch.js/src/widgets/index.ts | Exports new chatTrigger widget |
| packages/instantsearch.js/src/widgets/chat/chat.tsx | Adds setOpen/getOpen widget API + disableTriggerValidation param |
| packages/instantsearch.js/src/widgets/chat/tests/chat.test.tsx | Adds a negative test for entry-point validation |
| packages/instantsearch.js/src/widgets/chat-trigger/chat-trigger.tsx | Adds the new JS chatTrigger widget implementation |
| packages/instantsearch.js/src/widgets/autocomplete/autocomplete.tsx | Marks AI-mode Autocomplete widget as an entry point (opensChat) |
| packages/instantsearch.js/src/connectors/index.ts | Exports connectChatTrigger |
| packages/instantsearch.js/src/connectors/chat/connectChatTrigger.ts | Adds presence-marker connector that sets opensChat |
| packages/instantsearch.js/src/connectors/chat/connectChat.ts | Adds entry-point validation logic (+ opt-out flag) |
| packages/instantsearch.js/src/connectors/chat/tests/connectChat-test.ts | Adjusts tests to bypass validation where needed |
| packages/instantsearch.js/src/tests/common-widgets.test.tsx | Updates Chat test setup to bypass validation + expose setOpen |
| packages/instantsearch-ui-components/src/components/chat/types.ts | Makes toggleButtonComponent optional in layout props |
| packages/instantsearch-ui-components/src/components/chat/Chat.tsx | Removes built-in toggle button rendering |
| packages/instantsearch-ui-components/src/components/chat/tests/Chat.test.tsx | Snapshot updated after toggle button removal (currently shows leaked prop) |
| .claude/skills/port-widget/SKILL.md | Adds migration checklist guidance for cross-package API changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 31 out of 31 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (1)
packages/react-instantsearch/src/widgets/tests/utils/all-widgets.tsx:40
ChatTriggeris listed inNON_COMPONENTS, so it’s filtered out ofgetAllWidgets()and won’t be covered byall-components.test.tsx. It also makes thecase 'ChatTrigger'inWidget()unreachable from theSingleWidgetunion. IfChatTriggeris intended to be a public widget component, it should be removed fromNON_COMPONENTSso it participates in the generic component tests.
const NON_COMPONENTS = [
'createDefaultTools',
'SearchIndexToolType',
'RecommendToolType',
'MemorizeToolType',
'MemorySearchToolType',
'PonderToolType',
] as const;
type ComponentWidgets = Omit<typeof widgets, typeof NON_COMPONENTS[number]>;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds a separate chat trigger widget, and give a warning if you don't use it, ai mode or inline layout
still to do: validate this is the right approach, ensure there's no leftover code from previous iterations.