Pinelab-studio/pinelab-vendure-plugins / .agents/skills
migrating-vendure-admin-ui-to-react-dashboard
VerifiedMigrates Vendure Admin UI extensions (legacy Angular-based) to the new React Dashboard.
| File | Kind | Size |
|---|---|---|
| 01-general.md | markdown | 6.0 KB |
| 01a-common-tasks.md | markdown | 1.1 KB |
| 01b-tsconfig-setup.md | markdown | 1.5 KB |
| 01c-common-pitfalls.md | markdown | 3.9 KB |
| 02-forms.md | markdown | 1.5 KB |
| 03-custom-field-inputs.md | markdown | 3.6 KB |
| 04-list-pages.md | markdown | 8.7 KB |
| 05-detail-pages.md | markdown | 10.5 KB |
| 06-adding-nav-menu-items.md | markdown | 1.1 KB |
| 07-action-bar-items.md | markdown | 983 B |
| 08-custom-detail-components.md | markdown | 2.2 KB |
| 09-page-tabs.md | markdown | 481 B |
| 10-widgets.md | markdown | 2.8 KB |
| SKILL.md | skill md | 1.0 KB |
01c-common-pitfalls.md
View on GitHub## Common Pitfalls
### Import `graphql` from `@/gql`, NOT from `@vendure/dashboard`
The `graphql` function from `@vendure/dashboard` uses a **static** introspection based on the core Vendure schema only. It does not know about custom types from plugins (e.g. `Invoice`, `InvoiceList`).
Always import `graphql` from the **project-specific** gql-tada instance:
```tsx
// WRONG - uses core Vendure schema only, custom plugin types are unknown
import { graphql } from '@vendure/dashboard';
// CORRECT - uses the generated schema that includes all plugin types
import { graphql } from '@/gql';
```
The `@/gql` alias points to the generated `src/gql/graphql.ts` file (configured in `vite.config.mts` via `gqlOutputPath` and in the Vite `resolve.alias`).
**Symptoms of using the wrong import:**
- `ListPage` only queries `id` fields instead of all selected fields
- gql-tada type inference doesn't work (everything is `any`)
- Query field optimization strips all custom fields
### PaginatedList types must implement the `PaginatedList` interface
The `ListPage` component identifies paginated list types by checking if the GraphQL type **implements the `PaginatedList` interface**. Simply having `items` and `totalItems` fields is not enough.
The item type must also `implement Node` (requires `id: ID!`), because `PaginatedList` defines `items: [Node!]!`.
```graphql
# WRONG - ListPage won't recognize this as a paginated list
type Invoice {
id: ID!
# ...
}
type InvoiceList {
items: [Invoice!]!
totalItems: Int!
}
# CORRECT - both interfaces are required
type Invoice implements Node {
id: ID!
# ...
}
type InvoiceList implements PaginatedList {
items: [Invoice!]!
totalItems: Int!
}
```
**Symptoms of missing `implements PaginatedList`:**
- `ListPage` renders but shows no data
- The GraphQL query only requests `id` fields
- No error messages in the console
**Symptoms of missing `implements Node` on the item type:**
- Schema validation error mentioning `PaginatedList`
### Vite dev server CORS
When running the Vite dev server separately from the Vendure server, you may get CORS errors because the dashboard (e.g. `localhost:5173`) makes requests to the Vendure API (e.g. `localhost:3050`).
Fix this by adding CORS config to `vite.config.mts`, **not** to the Vendure config:
```ts
// vite.config.mts
export default defineConfig({
server: {
cors: {
origin: true,
credentials: true,
},
},
// ... rest of config
});
```
### Dashboard path in `@VendurePlugin` decorator
The `dashboard` path is resolved relative to the **source file** of the plugin (e.g. `src/invoice.plugin.ts`).
```ts
// If plugin is at src/my.plugin.ts and dashboard is at src/dashboard/index.tsx:
@VendurePlugin({
dashboard: './dashboard/index.tsx', // CORRECT - relative to src/
})
// WRONG - this would resolve to the package root, not src/
@VendurePlugin({
dashboard: '../dashboard/index.tsx',
})
```
### `FormFieldWrapper` requires `FormProvider`
The shadcn `FormControl` used inside `FormFieldWrapper` calls `useFormContext()` internally. You must wrap your form JSX with `<FormProvider>` from `react-hook-form`:
```tsx
import { FormProvider, useForm } from 'react-hook-form';
function MyConfigPage() {
const form = useForm({ defaultValues: { enabled: false } });
return (
<FormProvider {...form}>
<Page pageId="my-config">
<PageLayout>
<PageBlock column="main" blockId="config-form">
<FormFieldWrapper
control={form.control}
name="enabled"
label="Enabled"
render={({ field }) => (
<Switch
checked={field.value}
onCheckedChange={field.onChange}
/>
)}
/>
</PageBlock>
</PageLayout>
</Page>
</FormProvider>
);
}
```
**Symptom:** `Cannot destructure property 'getFieldState' of useFormContext as it is null`
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |