SolidJSS
SolidJSโ€ข3y agoโ€ข
9 replies
Braveheart

force a dom update when updating a signal before the rest of the onMount function

in this code csvColumns is dependant on setData, how can I force the render update?



  const csvColumns = (
    <Show when={data()}>
      <For each={data()}>{(item, index) => <ConnectionTarget name={item} />}</For>
    </Show>
  );

  onMount(() => {
    const csv = `Name,Email,Age
John Doe,johndoe@example.com,30
Jane Smith,janesmith@example.com,25
Alice Johnson,alicejohnson@example.com,35
`;
    const rows = csv.split('\n');
    const firstRow = rows[0].split(',');
    setData(firstRow);

    //offload the line drawing
    debugger;
    const colsX = csvColumns.map((component) => component());
  });
Was this page helpful?