Load conversation dashboard apps#117
Conversation
Reviewer's GuideLoads conversation-specific dashboard apps into the Chat page via an extended useDashboardApps hook that now supports per-display-type caching, adds a Vitest memory-backed Web Storage fallback, and introduces a test ensuring conversation apps are passed through to ChatTabs. Sequence diagram for loading conversation dashboard apps into ChatTabssequenceDiagram
actor User
participant Chat
participant useDashboardApps
participant integrationsService
participant ChatTabs
User->>Chat: open Chat page
Chat->>useDashboardApps: useDashboardApps(displayType='conversation')
activate useDashboardApps
useDashboardApps->>useDashboardApps: loadApps()
alt [no cached apps and no existing promise]
useDashboardApps->>integrationsService: getDashboardApps()
activate integrationsService
integrationsService-->>useDashboardApps: DashboardAppsResponse
deactivate integrationsService
useDashboardApps->>useDashboardApps: filterDashboardApps(data,'conversation')
useDashboardApps->>useDashboardApps: cache apps by 'conversation'
else [apps cached or promise in progress]
useDashboardApps->>useDashboardApps: reuse cached data/promise
end
useDashboardApps-->>Chat: apps (conversation)
deactivate useDashboardApps
Chat->>ChatTabs: render ChatTabs(dashboardApps=apps)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Sorry @juliomuhlbauer, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/hooks/useDashboardApps.ts" line_range="6-9" />
<code_context>
import { DashboardApp } from '@/types/integrations';
+import type { DashboardAppsResponse } from '@/types/integrations';
+
+type DashboardAppsDisplayType = 'sidebar' | 'conversation' | 'all';
interface UseDashboardAppsOptions {
</code_context>
<issue_to_address>
**question:** Clarify whether caching per displayType is intentional given a single backend call.
Right now the hook creates separate cache entries per `displayType`, but `integrationsService.getDashboardApps()` seems to always return all apps. That means a `sidebar` call and a later `conversation` call will each hit the network. If the backend indeed always returns the full list, consider caching that single raw response once and deriving per-`displayType` views in memory to avoid redundant requests.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| type DashboardAppsDisplayType = 'sidebar' | 'conversation' | 'all'; | ||
|
|
||
| interface UseDashboardAppsOptions { | ||
| /** |
There was a problem hiding this comment.
question: Clarify whether caching per displayType is intentional given a single backend call.
Right now the hook creates separate cache entries per displayType, but integrationsService.getDashboardApps() seems to always return all apps. That means a sidebar call and a later conversation call will each hit the network. If the backend indeed always returns the full list, consider caching that single raw response once and deriving per-displayType views in memory to avoid redundant requests.
What changed
Chat.tsxusinguseDashboardApps({ displayType: 'conversation' }).useDashboardAppsto supportsidebar,conversation, andall, with per-type caches.ChatTabs.localStorage/sessionStoragein Vitest.Why
dashboardAppsas an empty local array, soChatTabsnever received conversation apps.Validation
npm test -- src/pages/Customer/Chat/__tests__/Chat.spec.tsxnpm test -- src/components/layout/MainLayout.spec.tsxnpm run buildSummary by Sourcery
Load conversation-specific dashboard apps in the chat page using the shared dashboard apps hook and ensure they reach the chat tabs while improving test environment storage support.
New Features:
Enhancements:
Tests: