Skip to content

Calling table.SetState() does not seem to trigger sync with URL params #534

@jasonhilldm

Description

@jasonhilldm

First off I want to say that this module is super helpful!

I have found a problem with calling table.setState() to change multiple state values on the table. My use case is that I have a filter bar with a reset button that clears the global filter as well as all column filters:

table.setState((old) => ({
  ...old,
  globalFilter: undefined,
  columnFilters: [],
}));

When I define the onStateChange option on the table, I can see that the new state value has come through correctly with the above values reset, but the URL sync is not happening so the actual table filters do not get applied.

Maybe this call to table.setState() does not trigger the individual events like onGlobalFilterChange and onColumnFilterChange that you have defined in this module.

Would it be better to handle all table state changes via a single onStateChange event handler anyway instead of wiring up individual event handlers? Or did you find issues with that approach?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions