Skip to content

Commit 325cdd7

Browse files
committed
Fix TypeScript errors for CI build
- Remove unused imports and variables - Add null checks for rayforceClient - Fix type mismatches (cellStyle, getColumn) - Fix property names (typedArray instead of toTypedArray) - Remove loading prop from AgGrid (not supported)
1 parent 307a9ed commit 325cdd7

9 files changed

Lines changed: 23 additions & 40 deletions

File tree

apps/dashboard/src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ export function App() {
100100
});
101101

102102
return () => {
103-
rayforceClient.off('connected', handleConnected);
104-
rayforceClient.off('disconnected', handleDisconnected);
105-
rayforceClient.off('error', handleError);
103+
rayforceClient?.off('connected', handleConnected);
104+
rayforceClient?.off('disconnected', handleDisconnected);
105+
rayforceClient?.off('error', handleError);
106106
rayforceClient?.disconnect();
107107
};
108108
}, [sdkReady, isAuthenticated]); // Only depend on sdkReady and isAuthenticated

apps/dashboard/src/components/DashboardCanvas.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useCallback, useEffect, useState, useRef, useMemo } from 'react';
2-
import { useLensStore, Widget as WidgetType, Query } from '../store';
2+
import { useLensStore, Widget as WidgetType } from '../store';
33
import { shallow } from 'zustand/shallow';
44
import { DataGridWidget, paginateQuery, countQuery } from './widgets/DataGrid';
55
import { ChartWidget } from './widgets/Chart';
@@ -14,9 +14,6 @@ export function DashboardCanvas() {
1414
const setQueryResult = useLensStore(state => state.setQueryResult);
1515
const setQueryError = useLensStore(state => state.setQueryError);
1616
const setQueryRunning = useLensStore(state => state.setQueryRunning);
17-
const appMode = useLensStore(state => state.appMode);
18-
19-
const isDevMode = appMode === 'dev';
2017

2118
const activeDashboard = useLensStore(state =>
2219
state.workspace.dashboards.find(d => d.id === state.workspace.activeDashboardId)
@@ -45,7 +42,7 @@ export function DashboardCanvas() {
4542
console.log(`[DashboardCanvas] Running query "${query.name}" (${queryId.slice(0,8)}): ${query.code}`);
4643
setQueryRunning(query.id, true);
4744
try {
48-
const result = await rayforceClient.execute(query.code);
45+
const result = await rayforceClient!.execute(query.code);
4946
console.log(`[DashboardCanvas] Query "${query.name}" result:`, result.type, result.type === 'error' ? result.data : '');
5047
if (result.type === 'error') {
5148
setQueryError(query.id, String(result.data));
@@ -91,7 +88,7 @@ export function DashboardCanvas() {
9188

9289
setQueryRunning(queryId, true);
9390
try {
94-
const result = await rayforceClient.execute(currentQuery.code);
91+
const result = await rayforceClient!.execute(currentQuery.code);
9592
if (result.type === 'error') {
9693
setQueryError(queryId, String(result.data));
9794
} else {
@@ -355,7 +352,7 @@ function WidgetWrapper({ widget, isSelected, onSelect }: WidgetWrapperProps) {
355352

356353
// Use page data if available, otherwise use bound query result
357354
const gridData = pageData || boundQuery?.lastResult;
358-
const isServerSidePagination = boundQuery && isSimpleTableQuery(boundQuery.code) !== null;
355+
const isServerSidePagination = boundQuery ? isSimpleTableQuery(boundQuery.code) !== null : false;
359356

360357
// Inject totalRows into result for server-side pagination
361358
const dataWithRowCount = gridData && totalRows !== undefined ? {

apps/dashboard/src/components/Header.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export function Header({ onConnect }: HeaderProps) {
2020
const serverUrl = useLensStore(state => state.serverUrl);
2121
const setServerUrl = useLensStore(state => state.setServerUrl);
2222
const appMode = useLensStore(state => state.appMode);
23-
const toggleAppMode = useLensStore(state => state.toggleAppMode);
2423
const user = useLensStore(state => state.user);
2524
const logout = useLensStore(state => state.logout);
2625

apps/dashboard/src/components/Sidebar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ function QueriesPanel() {
9797
const setQueryResult = useLensStore(state => state.setQueryResult);
9898
const setQueryError = useLensStore(state => state.setQueryError);
9999
const setQueryRunning = useLensStore(state => state.setQueryRunning);
100-
const connectionStatus = useLensStore(state => state.connectionStatus);
101100

102101
const runQuery = async (queryId: string, code: string) => {
103102
if (!rayforceClient) {

apps/dashboard/src/components/widgets/Chart.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useMemo } from 'react';
1+
import { useMemo } from 'react';
22
import ReactECharts from 'echarts-for-react';
33
import type { EChartsOption } from 'echarts';
44
import type { RayforceResult } from '../../lib/rayforce';
@@ -41,13 +41,13 @@ function extractData(rawData: unknown): { categories: string[]; values: number[]
4141
// Try to get JS data
4242
if (result.toJS) {
4343
try {
44-
data = result.toJS();
44+
data = result.toJS() as Record<string, unknown>;
4545
} catch (e) {
4646
console.error('[Chart] toJS failed:', e);
4747
return { categories, values, series };
4848
}
4949
} else if (result.data !== undefined) {
50-
data = result.data;
50+
data = result.data as Record<string, unknown>;
5151
}
5252
}
5353

@@ -311,7 +311,7 @@ export function ChartWidget({ data, chartType }: ChartWidgetProps) {
311311
},
312312
series: [{
313313
type: 'candlestick' as const,
314-
data: values.map((v, i) => [v, v * 1.02, v * 0.98, v * 1.01]),
314+
data: values.map((v) => [v, v * 1.02, v * 0.98, v * 1.01]),
315315
itemStyle: {
316316
color: '#22c55e',
317317
color0: '#ef4444',

apps/dashboard/src/components/widgets/DataGrid.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface CustomHeaderProps extends IHeaderParams {
1212
}
1313

1414
function CustomHeader(props: CustomHeaderProps) {
15-
const { displayName, columnType, column, enableSorting, setSort } = props;
15+
const { displayName, columnType, enableSorting, setSort } = props;
1616
const [sortState, setSortState] = useState<'asc' | 'desc' | null>(null);
1717

1818
const handleSort = () => {
@@ -68,9 +68,6 @@ export interface CellColorRule {
6868
// Default color rules - empty by default, user can configure via Widget Config
6969
const DEFAULT_COLOR_RULES: CellColorRule[] = [];
7070

71-
// User-configurable color palettes for categorical columns
72-
// Empty by default - colors only applied when explicitly configured via Widget Config
73-
const DEFAULT_CATEGORY_COLORS: Record<string, string> = {};
7471

7572
// ============================================================================
7673
// CELL RENDERERS
@@ -578,7 +575,7 @@ export function DataGridWidget({
578575
// Apply user-configured column colors (from columnColorConfigs)
579576
const colorConfig = columnColorConfigs.find(cc => cc.column === name);
580577
if (colorConfig) {
581-
def.cellStyle = (params: CellClassParams) => {
578+
def.cellStyle = (params: CellClassParams): Record<string, string | number> | null | undefined => {
582579
const val = params.value;
583580

584581
if (colorConfig.type === 'preset' && colorConfig.preset) {
@@ -605,7 +602,7 @@ export function DataGridWidget({
605602
matches = numVal >= (rule.min ?? -Infinity) && numVal < (rule.max ?? Infinity);
606603
break;
607604
}
608-
if (matches) return rule.style as React.CSSProperties;
605+
if (matches) return rule.style as Record<string, string | number>;
609606
}
610607
}
611608
}
@@ -687,8 +684,7 @@ export function DataGridWidget({
687684
suppressRowClickSelection={true}
688685
headerHeight={32}
689686
rowHeight={28}
690-
getRowId={(params: GetRowIdParams) => params.data?.__rowId || params.data?.id || String(params.rowIndex)}
691-
loading={isLoading}
687+
getRowId={(params: GetRowIdParams) => params.data?.__rowId || params.data?.id || String(Math.random())}
692688
/>
693689
</div>
694690

apps/dashboard/src/components/widgets/Text.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import React from 'react';
21
import type { RayforceResult } from '../../lib/rayforce';
32

43
interface TextWidgetProps {

apps/dashboard/src/lib/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class Logger {
122122
// Use original console to avoid infinite loop
123123
const msg = `[${source}] ${message}`;
124124
if (data !== undefined) {
125-
(console as Record<string, (...args: unknown[]) => void>)[consoleMethod](msg, data);
125+
(console as unknown as Record<string, (...args: unknown[]) => void>)[consoleMethod](msg, data);
126126
}
127127
}
128128

apps/dashboard/src/lib/rayforce.ts

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@ interface Table extends RayObject {
8787
toRows(): Record<string, unknown>[];
8888
}
8989

90-
interface RayforceGlobal {
91-
init(options?: { wasmPath?: string; locateFile?: (file: string) => string }): Promise<RayforceSDK>;
92-
Types: typeof Types;
93-
}
9490

9591
// IPC header constants (from rayforce/core/serde.h)
9692
// Header: prefix(4) version(1) flags(1) endian(1) msgtype(1) size(8) = 16 bytes
@@ -109,7 +105,7 @@ export interface RayforceResult {
109105
source?: 'local' | 'remote';
110106

111107
/** Get column as TypedArray (zero-copy) */
112-
getColumn?: (name: string) => Float64Array | Int32Array | BigInt64Array | Uint8Array | null;
108+
getColumn?: (name: string) => ArrayBufferView | null;
113109
/** Convert to JS (use sparingly, triggers full copy) */
114110
toJS?: () => unknown;
115111
}
@@ -166,7 +162,6 @@ export class RayforceClient {
166162
private pendingRequests: Map<number, { resolve: (value: RayforceResult) => void; reject: (error: Error) => void }> = new Map();
167163
private requestId = 0;
168164
private sdk: RayforceSDK | null = null;
169-
private wasmModule: EmscriptenModule | null = null;
170165

171166
constructor() {
172167
// SDK loaded on demand
@@ -189,7 +184,6 @@ export class RayforceClient {
189184
}
190185

191186
this.sdk = sdk;
192-
this.wasmModule = sdk._wasm;
193187

194188
logInfo('Rayforce', `SDK loaded, version: ${this.sdk.version}`);
195189
}
@@ -429,7 +423,6 @@ export class RayforceClient {
429423
setTimeout(() => {
430424
if (this.pendingRequests.has(id)) {
431425
this.pendingRequests.delete(id);
432-
const execTime = performance.now() - startTime;
433426
logError('Query', `[REMOTE] Timeout after ${timeout}ms`);
434427
reject(new Error(`Query timeout after ${timeout}ms`));
435428
}
@@ -600,7 +593,7 @@ export class RayforceClient {
600593
}
601594

602595
private parseVector(view: DataView, offset: number, type: number): RayforceResult {
603-
const attrs = view.getUint8(offset);
596+
// Skip attrs byte
604597
offset += 1;
605598
const len = Number(view.getBigInt64(offset, true));
606599
offset += 8;
@@ -693,7 +686,7 @@ export class RayforceClient {
693686
columns,
694687
rowCount,
695688
toJS: () => rows,
696-
getColumn: (name: string) => wasmTable.col(name)?.toTypedArray?.() || null,
689+
getColumn: (name: string) => wasmTable.col(name)?.typedArray || null,
697690
};
698691
} catch {
699692
// Fall back to JS-only result
@@ -725,7 +718,7 @@ export class RayforceClient {
725718
// Simple dict: parse keys and values
726719
const { data: keys, bytesRead: keyBytes } = this.parseAnyWithSize(view, offset);
727720
offset += keyBytes;
728-
const { data: values, bytesRead: valBytes } = this.parseAnyWithSize(view, offset);
721+
const { data: values } = this.parseAnyWithSize(view, offset);
729722

730723
// If keys are symbols and values are vectors, create a table-like structure
731724
if (Array.isArray(keys) && Array.isArray(values)) {
@@ -994,7 +987,6 @@ export class RayforceClient {
994987
}
995988

996989
const type = Math.abs(obj.type);
997-
const sdk = this.sdk!;
998990

999991
// Table
1000992
if (type === Types.TABLE) {
@@ -1011,7 +1003,7 @@ export class RayforceClient {
10111003
getColumn: (name: string) => {
10121004
const col = table.col(name);
10131005
if (!col) return null;
1014-
return col.toTypedArray?.() || null;
1006+
return col.typedArray || null;
10151007
},
10161008
// Lazy JS conversion
10171009
toJS: () => table.toRows(),
@@ -1020,11 +1012,12 @@ export class RayforceClient {
10201012

10211013
// Vector
10221014
if (obj.isVector) {
1015+
const vec = obj as Vector;
10231016
return {
10241017
type: 'vector',
10251018
rayObject: obj,
10261019
// Zero-copy access for numeric vectors
1027-
getColumn: () => obj.toTypedArray?.() || null,
1020+
getColumn: () => vec.typedArray || null,
10281021
toJS: () => obj.toJS(),
10291022
};
10301023
}

0 commit comments

Comments
 (0)