Skip to content

remote + default sort + default filter - many onTableChange calls #799

Open
@python273

Description

@python273

Is there a way to avoid making multiple requests in onTableChange on table init?

Example of the problem:
https://stackblitz.com/edit/react-spttgg?file=index.js

An attempt to solve with blockRequests flag:
https://stackblitz.com/edit/react-circw1?file=index.js


It works like that now:

sort  Object { sortOrder: "asc", sortField: "id", filters: {}, page: 1, sizePerPage: 25, searchText: undefined }
filter  Object { sortOrder: "asc", sortField: "id", filters: {}, page: 1, sizePerPage: 25, searchText: "" }
table wrapper mounted

I was trying to add a flag to state like blockRequests, but it doesn't work since state is not updated with default filter after mount

  componentDidMount() {
    console.log('table wrapper mounted');
    // table prop: onTableChange={this.props.handleTableChange}

    // this.props.handleTableChange('init', {});  // <-- doesn't work
    setTimeout(() => this.props.handleTableChange('init', {}), 1);  // <-- ok, since state is updated
  };

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions