Skip to content

Commit 683d4e9

Browse files
Aurelioloclaude
andcommitted
fix: correct contains() cast, toolbar autodocs, and unhandled WS promise
- NodeContextMenu: cast e.target as Node (not HTMLElement) for contains() - OrgChartToolbar.stories: set component to OrgChartToolbar so autodocs reflect the real props, use render for interactive wrapper - company store: catch fetchCompanyData promise in WS handler to prevent unhandled rejection Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 551b32b commit 683d4e9

3 files changed

Lines changed: 16 additions & 5 deletions

File tree

web/src/pages/org/NodeContextMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function NodeContextMenu({
4545
// Close on outside click or Escape
4646
useEffect(() => {
4747
function handleClick(e: MouseEvent) {
48-
if (menuRef.current && !menuRef.current.contains(e.target as HTMLElement)) {
48+
if (menuRef.current && !menuRef.current.contains(e.target as Node)) {
4949
onClose()
5050
}
5151
}

web/src/pages/org/OrgChartToolbar.stories.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,23 @@ function InteractiveToolbar() {
1717

1818
const meta = {
1919
title: 'OrgChart/OrgChartToolbar',
20-
component: InteractiveToolbar,
20+
component: OrgChartToolbar,
2121
tags: ['autodocs'],
2222
parameters: {
2323
a11y: { test: 'error' },
2424
},
25-
} satisfies Meta<typeof InteractiveToolbar>
25+
render: () => <InteractiveToolbar />,
26+
} satisfies Meta<typeof OrgChartToolbar>
2627

2728
export default meta
2829
type Story = StoryObj<typeof meta>
2930

30-
export const Default: Story = {}
31+
export const Default: Story = {
32+
args: {
33+
viewMode: 'hierarchy',
34+
onViewModeChange: () => {},
35+
onFitView: () => {},
36+
onZoomIn: () => {},
37+
onZoomOut: () => {},
38+
},
39+
}

web/src/stores/company.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ export const useCompanyStore = create<CompanyState>()((set) => ({
5050
// Handle agent lifecycle events that affect company structure
5151
if (event.event_type === 'agent.hired' || event.event_type === 'agent.fired') {
5252
// Re-fetch company config to get updated agent list
53-
useCompanyStore.getState().fetchCompanyData()
53+
useCompanyStore.getState().fetchCompanyData().catch(() => {
54+
// Error is already set in store state by fetchCompanyData
55+
})
5456
}
5557
},
5658
}))

0 commit comments

Comments
 (0)