Skip to content

Commit e17586f

Browse files
Copilothotlong
andcommitted
Fix plugin-dashboard lint error and plugin-chatbot test environment
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 8a5ada9 commit e17586f

3 files changed

Lines changed: 8 additions & 3 deletions

File tree

packages/plugin-chatbot/src/__tests__/ChatbotEnhanced.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9+
import '@testing-library/jest-dom';
910
import { describe, it, expect, vi } from 'vitest';
1011
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
1112
import { ChatbotEnhanced, type ChatMessage } from '../ChatbotEnhanced';

packages/plugin-chatbot/vite.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export default defineConfig({
4747
},
4848
},
4949
test: {
50+
globals: true,
51+
environment: 'happy-dom',
5052
passWithNoTests: true,
5153
},
5254
});

packages/plugin-dashboard/src/DashboardRenderer.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import type { DashboardSchema, DashboardWidgetSchema } from '@object-ui/types';
1010
import { SchemaRenderer } from '@object-ui/react';
1111
import { cn, Card, CardHeader, CardTitle, CardContent } from '@object-ui/components';
12-
import { forwardRef, useMemo } from 'react';
12+
import { forwardRef } from 'react';
1313

1414
// Color palette for charts
1515
const CHART_COLORS = [
@@ -39,7 +39,7 @@ export const DashboardRenderer = forwardRef<HTMLDivElement, { schema: DashboardS
3939
// Logic to determine what to render
4040
// Supports both Component Schema (widget.component) and Shorthand (widget.type)
4141

42-
const componentSchema = useMemo(() => {
42+
const getComponentSchema = () => {
4343
if (widget.component) return widget.component;
4444

4545
// Handle Shorthand Registry Mappings
@@ -77,7 +77,9 @@ export const DashboardRenderer = forwardRef<HTMLDivElement, { schema: DashboardS
7777
}
7878

7979
return widget; // Fallback to widget itself as schema
80-
}, [widget]);
80+
};
81+
82+
const componentSchema = getComponentSchema();
8183

8284
// Check if the widget is self-contained (like a Metric Card) to avoid double borders
8385
const isSelfContained = (widget as any).type === 'metric';

0 commit comments

Comments
 (0)