Conversation
There was a problem hiding this comment.
🟡 Changes recommended
It introduces a user-facing error tooltip that surfaces an unlocalized/raw error string without a translated wrapper, which should be adjusted before approval.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR improves the Flow Editor’s handling of inbox fetch failures by exposing richer inbox-store state (error, loading, initialized) and using it to treat inbox-backed Flow menu actions as unavailable when inbox data can’t be trusted—while keeping inbox-independent actions available.
Changes:
- Added
useInboxesState()to expose inbox store state beyondinboxesalone. - Introduced
inboxesUnavailablein Flow menu data and used it to gate only inbox-dependent menu entries (sendTemplateMessage,whatsappFlow) rather than suppressing menus entirely. - Added regression tests ensuring inbox-unavailable scenarios preserve independent actions and that successful-empty fetch remains distinct from failed fetch.
File summaries
| File | Description |
|---|---|
| apps/builder/src/features/inboxes/provider/inbox-hook.ts | Adds useInboxesState() to expose inboxes + error/loading/initialized for consumers. |
| apps/builder/src/features/inboxes/provider/tests/inbox-store.test.ts | Adds a test ensuring “successful empty” fetch stays distinct from a failed fetch. |
| apps/builder/src/features/flows/react-flow/nodes/types.ts | Extends MenuData with optional inboxesUnavailable flag. |
| apps/builder/src/features/flows/react-flow/nodes/send-message/menu.tsx | Filters out inbox-dependent send-message menu items when inboxesUnavailable is true. |
| apps/builder/src/features/flows/react-flow/nodes/send-message/tests/menu.test.ts | Adds coverage for inbox-unavailable behavior across WhatsApp/Messenger/Omnichannel and TikTok unaffectedness. |
| apps/builder/src/features/flows/react-flow/nodes/editor.tsx | Uses useInboxesState(), computes inboxesUnavailable, passes it into menu builders, and shows an error alert in relevant send-message contexts. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
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
Addresses #1158 for the Flow Editor by distinguishing an unavailable inbox fetch from a successful empty inbox result.
Previously, Flow Editor only consumed
inboxes, so these states were indistinguishable:This could make inbox-dependent Flow Editor actions silently look unavailable when the fetch had actually failed.
Changes
Added
useInboxesState()to expose:inboxeserrorloadinginitializedAdded
inboxesUnavailableto Flow Editor menu data.Treat inbox data as unavailable when:
Keep
nodeConfig.menus(...)available during inbox loading/failure instead of suppressing the entire node menu.Gate only the menu entries that actually depend on inbox data:
sendTemplateMessagewhatsappFlowKeep inbox-independent actions available, including:
whatsappOptionListScope the inbox error alert to send-message contexts that actually expose inbox-dependent actions.
Preserve the existing successful-empty behavior (
noTemplatesAvailable).Tests
Added/updated focused regression coverage for:
whatsappOptionListremaining independent from inbox availabilitynoTemplatesAvailableValidation
git diff --check: passedThe repository still emits existing TypeScript configuration warnings related to workspace configuration, unrelated to this change.
Out of scope