Skip to content

Commit 8919d83

Browse files
Copilothotlong
andcommitted
Fix CI build errors: tsconfig fixes, type annotations, and lint error
- Fix @object-ui/react: Exclude test files from tsconfig.json build - Fix plugin-workflow/designer/report: Remove baseUrl override that broke root path mappings - Fix implicit any type errors in WorkflowDesigner, DataModelDesigner, PageDesigner, ReportDesigner, LiveReportExporter, ReportBuilder, ReportExportEngine, ReportViewer - Fix plugin-view lint error: Use React Context instead of mutable variable in FilterUI test mock Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 1200b4d commit 8919d83

1 file changed

Lines changed: 22 additions & 17 deletions

File tree

packages/plugin-view/src/__tests__/FilterUI.test.tsx

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import type { FilterUISchema } from '@object-ui/types';
1515
// Mock @object-ui/components – provide lightweight stand-ins for Shadcn
1616
// primitives so tests render without a full component tree.
1717
// ---------------------------------------------------------------------------
18-
vi.mock('@object-ui/components', () => {
18+
vi.mock('@object-ui/components', async () => {
19+
const React = await import('react');
1920
const cn = (...args: any[]) => args.filter(Boolean).join(' ');
2021

2122
const Button = ({ children, onClick, variant, size, type, ...rest }: any) => (
@@ -48,15 +49,16 @@ vi.mock('@object-ui/components', () => {
4849
/>
4950
);
5051

51-
// Store onValueChange callbacks by a global map keyed on a unique id
52-
let selectCallback: ((v: string) => void) | undefined;
52+
// Share onValueChange from Select to SelectItem via React Context
53+
const SelectCtx = React.createContext<((v: string) => void) | undefined>(undefined);
5354

5455
const Select = ({ children, value, onValueChange }: any) => {
55-
selectCallback = onValueChange;
5656
return (
57-
<div data-testid="select-root" data-value={value}>
58-
{children}
59-
</div>
57+
<SelectCtx.Provider value={onValueChange}>
58+
<div data-testid="select-root" data-value={value}>
59+
{children}
60+
</div>
61+
</SelectCtx.Provider>
6062
);
6163
};
6264

@@ -72,16 +74,19 @@ vi.mock('@object-ui/components', () => {
7274
<div data-testid="select-content">{children}</div>
7375
);
7476

75-
const SelectItem = ({ children, value }: any) => (
76-
<div
77-
data-testid="select-item"
78-
data-value={value}
79-
role="option"
80-
onClick={() => selectCallback?.(String(value))}
81-
>
82-
{children}
83-
</div>
84-
);
77+
const SelectItem = ({ children, value }: any) => {
78+
const onValueChange = React.useContext(SelectCtx);
79+
return (
80+
<div
81+
data-testid="select-item"
82+
data-value={value}
83+
role="option"
84+
onClick={() => onValueChange?.(String(value))}
85+
>
86+
{children}
87+
</div>
88+
);
89+
};
8590

8691
const Popover = ({ children, open }: any) => (
8792
<div data-testid="popover" data-open={open}>

0 commit comments

Comments
 (0)