Code Monkey home page Code Monkey logo

Comments (5)

aacevski avatar aacevski commented on April 28, 2024 1

Adding this piece of code in the TablePagination component fixes this issue:

 React.useEffect(() => {
    const newLastPage = Math.max(0, Math.ceil(count / rowsPerPage) - 1);
    if (page > newLastPage) {
      onPageChange(null, newLastPage);
    }
  }, [count, page, rowsPerPage, onPageChange]);

However should this fix be implemented in the component itself? If so, I can open a pull request for this fix - however in my honest opinion it would pollute the component itself. What do you guys think?

from material-ui.

lokomass avatar lokomass commented on April 28, 2024

Thanks for your reply, I've tried this in the sandbox : https://codesandbox.io/p/sandbox/zealous-perlman-forked-9kskcl
But problem is the same, we come back to first page, but Mui error appears again

from material-ui.

aacevski avatar aacevski commented on April 28, 2024

Yep, this happens because of line 374 in the TablePagination.js component.

image

I would propose to add the useEffect fix in the component itself (in the core component I mean) and remove this warning since that use case will be handled with the useEffect.

from material-ui.

lokomass avatar lokomass commented on April 28, 2024

You mean in the node_module folder ??? There isn't another solution ?

from material-ui.

aacevski avatar aacevski commented on April 28, 2024

You mean in the node_module folder ??? There isn't another solution ?

No no, I mean I meant to add this code in the core package so it gets fixed for you, but that was more of a question to the maintainers haha, sorry for the confusion.

from material-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.