Skip to content

Commit cf8b93f

Browse files
keugenekclaude
andauthored
Update AppKit template for SDK 0.1.4 (#4292)
## Summary Updates AppKit template to align with SDK 0.1.2 and fix documentation issues causing build failures. **Changes:** 1. **Package versions**: Bump `@databricks/appkit` and `@databricks/appkit-ui` from `0.0.2` to `0.1.2` 2. **Import path fix**: `@databricks/app-kit` → `@databricks/appkit` in docs 3. **Chart children fix**: Remove Recharts children pattern from LineChart (use props instead) 4. **Import cleanup**: Remove unused recharts imports from App.tsx 5. **Documentation**: Add chart children warning, fix import paths **Root causes addressed:** - Agents using `<LineChart><Line .../></LineChart>` → TypeScript errors (charts don't accept children) - Agents using wrong import path → module not found errors - Outdated package versions → missing features ## Test plan - Template changes only - Manual testing with app generation 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent fa62e53 commit cf8b93f

File tree

4 files changed

+24
-28
lines changed

4 files changed

+24
-28
lines changed

experimental/aitools/templates/appkit/template/{{.project_name}}/client/src/App.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
SelectValue,
1717
} from '@databricks/appkit-ui/react';
1818
import { sql } from "@databricks/appkit-ui/js";
19-
import { Line, XAxis, YAxis, CartesianGrid, Tooltip } from 'recharts';
2019
import { trpc } from './lib/trpc';
2120
import { useState, useEffect } from 'react';
2221

@@ -184,15 +183,13 @@ function App() {
184183
<CardTitle>Sales Trend Custom Line Chart</CardTitle>
185184
</CardHeader>
186185
<CardContent>
187-
<LineChart queryKey="mocked_sales" parameters={salesParameters}>
188-
<CartesianGrid strokeDasharray="3 3" />
189-
<Line type="monotone" dataKey="revenue" stroke="#40d1f5" />
190-
<Line type="monotone" dataKey="expenses" stroke="#4462c9" />
191-
<Line type="monotone" dataKey="customers" stroke="#EB1600" />
192-
<XAxis dataKey="month" />
193-
<YAxis />
194-
<Tooltip />
195-
</LineChart>
186+
<LineChart
187+
queryKey="mocked_sales"
188+
parameters={salesParameters}
189+
xKey="month"
190+
yKey={["revenue", "expenses", "customers"]}
191+
colors={['#40d1f5', '#4462c9', '#EB1600']}
192+
/>
196193
</CardContent>
197194
</Card>
198195
<Card className="shadow-lg flex min-w-0">

experimental/aitools/templates/appkit/template/{{.project_name}}/docs/appkit-sdk.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { MyInterface, MyType } from '../../shared/types';
1717
## Server Setup
1818

1919
```typescript
20-
import { createApp, server, analytics } from '@databricks/app-kit';
20+
import { createApp, server, analytics } from '@databricks/appkit';
2121

2222
const app = await createApp({
2323
plugins: [
@@ -45,12 +45,11 @@ Use cases:
4545
- Data that needs transformation before display
4646

4747
```typescript
48-
import { useAnalyticsQuery, Skeleton } from '@databricks/app-kit-ui/react';
49-
50-
interface QueryResult { column_name: string; value: number; }
48+
import { useAnalyticsQuery, Skeleton } from '@databricks/appkit-ui/react';
49+
import { sql } from '@databricks/appkit-ui/js';
5150

5251
function CustomDisplay() {
53-
const { data, loading, error } = useAnalyticsQuery<QueryResult[]>('query_name', {
52+
const { data, loading, error } = useAnalyticsQuery('query_name', {
5453
start_date: sql.date(Date.now()),
5554
category: sql.string("tools")
5655
});

experimental/aitools/templates/appkit/template/{{.project_name}}/docs/frontend.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ function MyDashboard() {
3535

3636
Components automatically fetch data, show loading states, display errors, and render with sensible defaults.
3737

38-
**Custom Visualization (Recharts):**
38+
**⚠️ CRITICAL: AppKit charts do NOT support children**
3939

4040
```typescript
41+
// ❌ WRONG - AppKit charts don't accept Recharts children
4142
import { BarChart } from '@databricks/appkit-ui/react';
42-
import { Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend } from 'recharts';
43-
44-
<BarChart queryKey="sales_by_region" parameters={{}}>
45-
<CartesianGrid strokeDasharray="3 3" />
46-
<XAxis dataKey="region" />
47-
<YAxis />
48-
<Tooltip />
49-
<Legend />
50-
<Bar dataKey="revenue" fill="#40d1f5" />
51-
<Bar dataKey="expenses" fill="#4462c9" />
43+
import { Bar, XAxis, YAxis } from 'recharts';
44+
<BarChart queryKey="sales" parameters={{}}>
45+
<XAxis dataKey="region" /> // TypeScript error!
46+
<Bar dataKey="revenue" /> // TypeScript error!
5247
</BarChart>
48+
49+
// ✅ CORRECT - Use simple self-closing syntax
50+
<BarChart queryKey="sales" parameters={{}} />
5351
```
5452

53+
AppKit charts auto-configure axes, tooltips, and styling. Do NOT import Recharts components.
54+
5555
Databricks brand colors: `['#40d1f5', '#4462c9', '#EB1600', '#0B2026', '#4A4A4A', '#353a4a']`
5656

5757
**❌ Don't double-fetch:**

experimental/aitools/templates/appkit/template/{{.project_name}}/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"license": "Unlicensed",
2828
"description": "",
2929
"dependencies": {
30-
"@databricks/appkit": "^0.0.2",
31-
"@databricks/appkit-ui": "^0.0.2",
30+
"@databricks/appkit": "^0.1.4",
31+
"@databricks/appkit-ui": "^0.1.4",
3232
"@databricks/sdk-experimental": "^0.14.2",
3333
"@radix-ui/react-accordion": "^1.2.12",
3434
"@radix-ui/react-alert-dialog": "^1.1.15",

0 commit comments

Comments
 (0)