vincjo / datatables

A toolkit for creating datatable components with Svelte
https://vincjo.fr/datatables
MIT License
474 stars 18 forks source link

Error "RangeError: Maximum call stack size exceeded" on clearSearch() #134

Closed evapastors closed 1 month ago

evapastors commented 1 month ago

I'm using the runes version and whenever I call table.clearSearch() I get the error "RangeError: Maximum call stack size exceeded".

I created this minimal example of a table with a searchbar:

 <script lang="ts">
  import { TableHandler } from "@vincjo/datatables";

  const test: { name: string; address: string }[] = [
    { name: "Max Mustermann", address: "Example Street 1" },
    { name: "Test Person", address: "Street 2" },
  ];

  const handler = new TableHandler(test);

  const search = handler.createSearch(["name"]);

  const onReset = () => {
    handler.clearSearch();
  };
</script>

<input type="text" bind:value={search.value} oninput={() => search.set()} />

<div>
  {#each handler.rows as row}
    <div>
      <div>{row.name}</div>
    </div>
  {/each}
</div>

<button type="button" onclick={onReset}>Clear</button>
Bildschirmfoto 2024-10-16 um 13 49 34
vincjo commented 1 month ago

Thx for the repro. I wouldn't have noticed this one. The internal event dispatcher caused the error. Fix published in 2.0.0-runes.45