SolidJSS
SolidJSโ€ข2y agoโ€ข
4 replies
Mobs

Running into ambiguous error

Hi, I am experiencing a really bizarre error in my click handler. And am not sure on how to debug.
I have tried removing the .vite directory and tried rerunning but no luck.
Suspiciously this only started when I changed my code slightly

from being:
function loadLabels() {
    const saved: typeof props.measurements = deepCopy(props.measurements);
    if (saved) {
      let labels: any[] = [];
      for (const analysis of Object.values(saved)) {
        labels = labels.concat(Object.values(analysis.instructions));
      }
      setLabels(labels);
    }
}

to:
function loadLabels() {
    const saved: typeof props.measurements = deepCopy(props.measurements);
        if (saved) {
    let labels: any = {};
    for (const analysis of Object.values(saved)) {
            for (const instruction of analysis.instructions) {
                labels[instruction.name] = 0;
            }
    }
    setLabels(labels);
    }
}

And this function here is in the component that shows up when I click the tab associated to it.
    createEffect(
        on(
            () => props.measurements,
            () => {
                if (!props.measurements) return;
                getErrors();
                setSelectedAgent(props.optimizationData.agent);
                loadLabels();
                loadExpressions();
            }
        )
    );

gets called initially in this effect
image.png
Was this page helpful?