Skip to content

Commit bb718db

Browse files
committed
fix: enhance type handling in kernel and grid components, update documentation for clarity
1 parent 6974168 commit bb718db

5 files changed

Lines changed: 20 additions & 20 deletions

File tree

apps/console/src/mocks/createKernel.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* see https://github.com/objectstack-ai/spec
1313
*/
1414

15-
import { ObjectKernel, DriverPlugin, AppPlugin } from '@objectstack/runtime';
15+
import { ObjectKernel, DriverPlugin, AppPlugin, type Plugin } from '@objectstack/runtime';
1616
import { ObjectQLPlugin } from '@objectstack/objectql';
1717
import { InMemoryDriver, MemoryAnalyticsService } from '@objectstack/driver-memory';
1818
import { MSWPlugin } from '@objectstack/plugin-msw';
@@ -312,12 +312,12 @@ export async function createKernel(options: KernelOptions): Promise<KernelResult
312312
skipSystemValidation
313313
});
314314

315-
await kernel.use(new ObjectQLPlugin());
315+
await kernel.use(new ObjectQLPlugin() as unknown as Plugin);
316316
await kernel.use(new DriverPlugin(driver, 'memory'));
317317
for (const config of configs) {
318318
await kernel.use(new AppPlugin(config));
319319
}
320-
await kernel.use(new SetupPlugin());
320+
await kernel.use(new SetupPlugin() as unknown as Plugin);
321321

322322
// Register MemoryAnalyticsService so that HttpDispatcher can serve
323323
// /api/v1/analytics/* endpoints in demo/MSW/dev environments.

examples/msw-todo/src/mocks/browser.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* and the MSW Plugin which automatically exposes the API.
66
*/
77

8-
import { ObjectKernel, DriverPlugin, AppPlugin } from '@objectstack/runtime';
8+
import { ObjectKernel, DriverPlugin, AppPlugin, type Plugin } from '@objectstack/runtime';
99
import { ObjectQLPlugin } from '@objectstack/objectql';
1010
import { InMemoryDriver } from '@objectstack/driver-memory';
1111
import { MSWPlugin } from '@objectstack/plugin-msw';
@@ -27,20 +27,20 @@ export async function startMockServer() {
2727
});
2828

2929
// Register ObjectQL engine
30-
await kernel.use(new ObjectQLPlugin())
31-
30+
await kernel.use(new ObjectQLPlugin() as unknown as Plugin)
31+
3232
// Register the driver
33-
await kernel.use(new DriverPlugin(driver, 'memory'))
34-
33+
await kernel.use(new DriverPlugin(driver, 'memory') as unknown as Plugin)
34+
3535
// Load todo app config as a plugin
36-
await kernel.use(new AppPlugin(todoConfig))
37-
36+
await kernel.use(new AppPlugin(todoConfig) as unknown as Plugin)
37+
3838
// MSW Plugin (intercepts network requests)
3939
await kernel.use(new MSWPlugin({
4040
enableBrowser: true,
4141
baseUrl: '/api/v1',
4242
logRequests: true
43-
}));
43+
}) as unknown as Plugin);
4444

4545
await kernel.bootstrap();
4646

objectstack.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { ObjectQLPlugin } from '@objectstack/objectql';
99
import { InMemoryDriver } from '@objectstack/driver-memory';
1010
import { HonoServerPlugin } from '@objectstack/plugin-hono-server';
1111
import { AuthPlugin } from '@objectstack/plugin-auth';
12-
import { SetupPlugin, SETUP_APP_DEFAULTS } from '@objectstack/plugin-setup';
12+
import { SetupPlugin } from '@objectstack/plugin-setup';
1313
import { ConsolePlugin } from '@object-ui/console';
1414
import { createMemoryI18n } from '@objectstack/core';
1515
import { mergeViewsIntoObjects } from '@object-ui/core';
@@ -58,20 +58,20 @@ class MemoryI18nPlugin {
5858
export default {
5959
plugins: [
6060
new MemoryI18nPlugin(),
61+
// SetupPlugin first: registers setupNav during init for contributing plugins,
62+
// and registers the merged Setup app during start before ObjectQL scans.
63+
new SetupPlugin(),
6164
new ObjectQLPlugin(),
6265
new DriverPlugin(new InMemoryDriver()),
6366
// Each example stack loaded as an independent AppPlugin
6467
new AppPlugin(prepareConfig(crmConfig)),
6568
new AppPlugin(prepareConfig(todoConfig)),
6669
new AppPlugin(prepareConfig(kitchenSinkConfig)),
67-
// Setup App registered via AppPlugin so ObjectQLPlugin discovers it.
68-
// SetupPlugin also registers setupNav service for future navigation contributions.
69-
new AppPlugin({ apps: [SETUP_APP_DEFAULTS], manifest: { id: 'setup', name: 'setup' } }),
70+
// AuthPlugin after ObjectQL (needs 'data' service) and after SetupPlugin (uses setupNav)
7071
new AuthPlugin({
7172
secret: process.env.AUTH_SECRET || 'objectui-dev-secret',
7273
baseUrl: 'http://localhost:3000',
7374
}),
74-
new SetupPlugin(),
7575
new HonoServerPlugin({ port: 3000 }),
7676
new ConsolePlugin(),
7777
],

packages/components/src/renderers/complex/data-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
974974
) : typeof col.cell === 'function' ? (
975975
col.cell(cellValue, row)
976976
) : (
977-
cellValue
977+
cellValue != null && typeof cellValue === 'object' ? String(cellValue) : cellValue
978978
)}
979979
</TableCell>
980980
);

packages/plugin-grid/src/ObjectGrid.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,7 +1262,7 @@ export const ObjectGrid: React.FC<ObjectGridProps> = ({
12621262
{/* Title row - Name as bold prominent title */}
12631263
{titleCol && (
12641264
<div className="font-semibold text-sm truncate mb-1">
1265-
{row[titleCol.accessorKey] ?? '—'}
1265+
{row[titleCol.accessorKey] != null && typeof row[titleCol.accessorKey] === 'object' ? String(row[titleCol.accessorKey]) : (row[titleCol.accessorKey] ?? '—')}
12661266
</div>
12671267
)}
12681268

@@ -1273,15 +1273,15 @@ export const ObjectGrid: React.FC<ObjectGridProps> = ({
12731273
<span className="text-sm tabular-nums font-medium">
12741274
{typeof row[amountCol.accessorKey] === 'number'
12751275
? formatCompactCurrency(row[amountCol.accessorKey])
1276-
: row[amountCol.accessorKey] ?? '—'}
1276+
: (row[amountCol.accessorKey] != null && typeof row[amountCol.accessorKey] === 'object' ? String(row[amountCol.accessorKey]) : (row[amountCol.accessorKey] ?? '—'))}
12771277
</span>
12781278
)}
12791279
{stageCol && row[stageCol.accessorKey] && (
12801280
<Badge
12811281
variant="outline"
12821282
className={`text-xs shrink-0 max-w-[140px] truncate ${stageBadgeColor(String(row[stageCol.accessorKey]))}`}
12831283
>
1284-
{row[stageCol.accessorKey]}
1284+
{String(row[stageCol.accessorKey])}
12851285
</Badge>
12861286
)}
12871287
</div>

0 commit comments

Comments
 (0)