From b9f3cbc58d66478656f547d1672a0b39a01c2e88 Mon Sep 17 00:00:00 2001 From: Sam Nystrom Date: Tue, 12 Mar 2024 17:37:22 -0400 Subject: fix(nodes): handle null input in Fourier --- src/nodes/Fourier.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/nodes/Fourier.tsx b/src/nodes/Fourier.tsx index f95f26d..b9bda3f 100644 --- a/src/nodes/Fourier.tsx +++ b/src/nodes/Fourier.tsx @@ -2,11 +2,11 @@ import { NodeShell, InputArray, OutputNumber, NodeComponentProps, NodeInfo } fro import { fft } from '../wasm.ts'; export interface FourierInputs { - data: Float32Array, + data: Float32Array | null, } export interface FourierOutputs { - data: Float32Array, + data: Float32Array | null, } export const Fourier = ({ id, x, y, inputs }: NodeComponentProps) => { @@ -20,6 +20,6 @@ export const Fourier = ({ id, x, y, inputs }: NodeComponentProps) export const FourierNode: NodeInfo = { component: Fourier, - func: ({ data }) => ({ data: fft(data) }), - inputs: { data: new Float32Array(0) }, -}; \ No newline at end of file + func: ({ data }) => ({ data: data ? fft(data) : null }), + inputs: { data: null }, +}; -- cgit v1.2.3