Skip to content

Infinite calls to onRowSelect when useDataTable data is empty #160

@diegof29

Description

@diegof29

When the data passed to useDataTable is an empty array then the onRowSelect callback gets called in an infinite loop. I think it has something to do with the deps here:

 useEffect(() => {
    if (isSelectable) {
      onRowSelect({
        globalFilter,
        filters,
        filtersByKey: filtersArrayToObject(filters),
        manualFilters,
        manualFiltersByKey: filtersArrayToObject(manualFilters),
        pageIndex,
        pageSize,
        selectedRows: Object.keys(selectedRowIds)
      });
    }
  }, [
    globalFilter,
    filters,
    manualFilters,
    onFetchData,
    pageIndex,
    pageSize,
    selectedRowIds
  ]);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions