Compare commits
1 Commits
e6c368afaa
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
4dd5f633d4
|
@@ -165,7 +165,7 @@ export class GraphState {
|
||||
this.edges.delete(edgeId);
|
||||
}
|
||||
|
||||
private _dirtyPositions = new Set<NodeInstance>();
|
||||
private _dirtyPositions = new SvelteSet<NodeInstance>();
|
||||
private _positionFlushPending = false;
|
||||
|
||||
private _flushPositions() {
|
||||
|
||||
@@ -136,13 +136,14 @@ export class RemoteNodeRegistry implements NodeRegistry {
|
||||
}
|
||||
|
||||
async register(id: string, wasmBuffer: ArrayBuffer) {
|
||||
let wrapper: ReturnType<typeof createWasmWrapper> = null!;
|
||||
try {
|
||||
wrapper = createWasmWrapper(wasmBuffer);
|
||||
} catch (error) {
|
||||
console.error(`Failed to create node wrapper for node: ${id}`, error);
|
||||
throw error;
|
||||
}
|
||||
const wrapper = (() => {
|
||||
try {
|
||||
return createWasmWrapper(wasmBuffer);
|
||||
} catch (error) {
|
||||
console.error(`Failed to create node wrapper for node: ${id}`, error);
|
||||
throw error;
|
||||
}
|
||||
})();
|
||||
|
||||
const rawDefinition = wrapper.get_definition();
|
||||
const definition = NodeDefinitionSchema.safeParse(rawDefinition);
|
||||
|
||||
@@ -137,7 +137,8 @@ function getValue(input: NodeInput, value?: unknown) {
|
||||
if (input.type === 'select' && typeof value !== 'number') {
|
||||
const index = input.options?.indexOf(value as string);
|
||||
if (index === undefined || index < 0) {
|
||||
throw new Error(`Unknown value ${value} for select input ${input.label}`);
|
||||
// Defaultl to the first option
|
||||
return 0;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user