You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Revised the overview to clarify features, removing redundant mentions of column sorting and filtering.
- Updated the setup instructions to replace Storybook setup with NuqsAdapter setup for URL state management.
- Enhanced the documentation on Medusa Admin setup, emphasizing the need for the NuqsAdapter and providing code examples.
- Improved clarity on key features, including column management capabilities.
- Removed outdated sections related to Storybook decorators and unnecessary provider details.
The `EditableTable` is a powerful, feature-rich React component built for the Medusa2 admin interface that provides inline editing capabilities for tabular data. It combines the flexibility of TanStack Table with real-time validation, auto-save functionality, column sorting, filtering, and URL state persistence to create an efficient data management experience.
5
+
The `EditableTable` is a powerful, feature-rich React component built for the Medusa2 admin interface that provides inline editing capabilities for tabular data. It combines the flexibility of TanStack Table with real-time validation, auto-save functionality, and URL state persistence to create an efficient data management experience.
6
6
7
7
## Installation & Peer Dependencies
8
8
@@ -41,173 +41,61 @@ For virtual scrolling support with large datasets:
41
41
yarn add @tanstack/react-virtual@^3.10.0
42
42
```
43
43
44
-
## Storybook Setup Requirements
44
+
## NuqsAdapter Setup
45
45
46
-
> **Prerequisites:** Make sure you have installed all [peer dependencies](#installation--peer-dependencies) before setting up Storybook stories.
46
+
The `EditableTable` component uses `nuqs` for URL state persistence (search, filters, pagination, sorting). Since Medusa Admin uses React Router v6, you need to wrap your page content with the `NuqsAdapter` from `nuqs/adapters/react-router/v6`.
47
47
48
-
The `EditableTable` component requires several context providers to function correctly in Storybook (or any standalone environment). Below are the required providers and the errors you'll encounter if they're missing:
48
+
> **Note:** The adapter required depends on your React framework. For Medusa Admin (React Router v6), use `nuqs/adapters/react-router/v6`. For other frameworks, see the [official nuqs adapters documentation](https://nuqs.dev/docs/adapters).
49
49
50
-
### Required Providers
50
+
### Medusa Admin Setup
51
51
52
-
#### 1. NuqsAdapter (URL State Management)
53
-
**Package:**`nuqs` (peer dependency)
54
-
**Error if missing:**
55
-
```
56
-
[nuqs] nuqs requires an adapter to work with your framework.
57
-
```
58
-
59
-
**Why needed:** The EditableTable uses `nuqs` for URL state persistence (search, filters, pagination, sorting). In Storybook, which doesn't have a framework router, you need the React adapter.
60
-
61
-
**Setup:**
62
-
```typescript
63
-
import { NuqsAdapter } from'nuqs/adapters/react';
64
-
```
52
+
In Medusa Admin, add the `NuqsAdapter` at the page level when creating custom pages:
-`EditableTable` - Main component from medusa-forms package
168
-
-`Toaster`, `TooltipProvider` - From `@medusajs/ui` peer dependency
169
-
-`QueryClient`, `QueryClientProvider` - From `@tanstack/react-query` peer dependency
170
-
-`NuqsAdapter` - From `nuqs` peer dependency (React adapter for standalone usage)
171
-
172
-
### Provider Hierarchy
173
-
174
-
The providers must be nested in this specific order (outermost to innermost):
83
+
**Why needed:** The `NuqsAdapter` provides the routing context that `nuqs` requires to synchronize table state (search, filters, pagination, sorting) with the URL query parameters.
175
84
85
+
**Error if missing:**
176
86
```
177
-
NuqsAdapter ← URL state management
178
-
└─ QueryClientProvider ← React Query context
179
-
└─ TooltipProvider ← Medusa UI tooltips
180
-
└─ Your Content
181
-
└─ Toaster ← Toast notifications (sibling to content)
87
+
[nuqs] nuqs requires an adapter to work with your framework.
0 commit comments