Skip to content

Commit f75564c

Browse files
committed
fix(web): unbreak kg-web tsc build for v0.12.0 release
Three type-only fixes blocking `tsc -b` (no runtime change, emitted JS is identical — these only satisfy the type checker): - BlockPalette: PaletteBlock.icon typed React.ElementType -> LucideIcon. React 19's @types/react resolves className to `never` on the wide ElementType union; every palette icon is a lucide icon anyway, so the precise type is also the correct one. - ForceGraph types: EngineNode.source / EngineEdge.source typed APIGraphNode / APIGraphLink -> RawGraphNode / RawGraphLink. These now match what transformForEngine actually receives — the store's canonical raw-graph format (ontology optional), not the REST payload. - useFitCamera / useOrientAndFrame: parametrize three.js's now-generic EventDispatcher as EventDispatcher<{ start: object }> so addEventListener('start') is not rejected against the empty default event map ({} -> keyof {} -> never). Tag v0.12.0 moved forward to this commit so the release tag points at a commit where the full image set builds.
1 parent 2d16733 commit f75564c

4 files changed

Lines changed: 12 additions & 9 deletions

File tree

web/src/components/blocks/BlockPalette.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import React, { useState } from 'react';
7-
import { Search, Network, Filter, GitBranch, Circle, Hash, Play, Square, Merge, Split, Ban, Sparkles, Snowflake, HelpCircle, Shield, FileText } from 'lucide-react';
7+
import { Search, Network, Filter, GitBranch, Circle, Hash, Play, Square, Merge, Split, Ban, Sparkles, Snowflake, HelpCircle, Shield, FileText, type LucideIcon } from 'lucide-react';
88
import type { BlockType } from '../../types/blocks';
99
import { BlockHelpPopup } from './BlockHelpPopup';
1010

@@ -15,7 +15,7 @@ interface BlockPaletteProps {
1515

1616
interface PaletteBlock {
1717
type: BlockType;
18-
icon: React.ElementType;
18+
icon: LucideIcon;
1919
label: string;
2020
description: string;
2121
color: string;

web/src/explorers/ForceGraph/scene/useFitCamera.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const SETTLE_MS = 2000;
5656
*/
5757
export function useFitCamera(orient: () => void, nodes: EngineNode[]): void {
5858
const invalidate = useThree((s) => s.invalidate);
59-
const controls = useThree((s) => s.controls) as EventDispatcher | null;
59+
const controls = useThree((s) => s.controls) as EventDispatcher<{ start: object }> | null;
6060

6161
const armedRef = useRef(false);
6262
const firedRef = useRef(false);

web/src/explorers/ForceGraph/scene/useOrientAndFrame.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export function useOrientAndFrame(
122122
): OrientAndFrame {
123123
const camera = useThree((s) => s.camera);
124124
const controls = useThree((s) => s.controls) as
125-
| (THREE.EventDispatcher & {
125+
| (THREE.EventDispatcher<{ start: object }> & {
126126
target: THREE.Vector3;
127127
update: () => void;
128128
})

web/src/explorers/ForceGraph/types.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* (separate id/label, edge-type palette, directed arrows).
77
*/
88

9-
import type { APIGraphNode, APIGraphLink } from '../../types/graph';
9+
import type { RawGraphNode, RawGraphLink } from '../../utils/cypherResultMapper';
1010
import type { NodeColorMode } from '../common';
1111

1212
export type { NodeColorMode };
@@ -23,8 +23,10 @@ export interface EngineNode {
2323
degree: number;
2424
/** Whether the engine should hold this node's position against the sim. */
2525
pinned?: boolean;
26-
/** Full API payload passed through so widgets can read without re-fetch. */
27-
source?: APIGraphNode;
26+
/** Full raw-graph payload passed through so widgets can read without re-fetch.
27+
* This is the store's canonical RawGraphNode — what transformForEngine
28+
* actually receives — not the REST APIGraphNode. */
29+
source?: RawGraphNode;
2830
}
2931

3032
/** An edge as consumed by the unified rendering engine. @verified c17bbeb9 */
@@ -37,8 +39,9 @@ export interface EngineEdge {
3739
type: string;
3840
/** Optional weight, may drive line thickness or arrow size. */
3941
weight?: number;
40-
/** Full API payload passed through. */
41-
source?: APIGraphLink;
42+
/** Full raw-graph payload passed through — the store's canonical
43+
* RawGraphLink, not the REST APIGraphLink. */
44+
source?: RawGraphLink;
4245
}
4346

4447
/** Data shape the ForceGraph explorer plugin consumes. @verified c17bbeb9 */

0 commit comments

Comments
 (0)