Code Monkey home page Code Monkey logo

Comments (6)

michelengelen avatar michelengelen commented on May 28, 2024

Hey @marcpachecog and thanks for raising this.
It's actually a good question why we did not implement a complimentary event listener for mouseOver.

I will add this to the board.

On another note: Why did we go for mouseOver and not mouseEnter? mouseOver will "drill down" the handler to all children and this could potentially impact performance in complicated cell renderers. This W3Schools example schowcases it really well

WDYT @mui/xgrid ?

from mui-x.

flaviendelangle avatar flaviendelangle commented on May 28, 2024

This relates to this page

TLDR: We removed those events from apiRef.subscribeEvent so that only people that need them pay the performance price of setting the event on the HTML element.
So adding them back is probably not a good solution.

But maybe we can improve the doc or the behaviors on how people can pass other event listeners to a cell / a row.

from mui-x.

romgrk avatar romgrk commented on May 28, 2024

Feels inconsistent that we publish cellMouseOver but not cellMouseLeave.

so that only people that need them pay the performance price of setting the event on the HTML element.

@flaviendelangle I'm curious about the performance justification, isn't react supposed to use event bubbling and only attach event listeners to the root of the tree? Something like this: https://blog.logrocket.com/event-bubbling-capturing-react/
Either way it's good that we remove unused props though.

@marcpachecog Wdym by "prevent rerenders"? You shouldn't be passing inline objects directly, maybe this section of the docs would help: https://mui.com/x/react-data-grid/performance/#extract-static-objects-and-memoize-root-props

from mui-x.

flaviendelangle avatar flaviendelangle commented on May 28, 2024

Feels inconsistent that we publish cellMouseOver but not cellMouseLeave.

I think we just kept the one we were using internally

@flaviendelangle I'm curious about the performance justification, isn't react supposed to use event bubbling and only attach event listeners to the root of the tree? Something like this: https://blog.logrocket.com/event-bubbling-capturing-react/

It was the justification when the change was done, but I never explored the topic tbh.
If we publish an event even if there is no-one listening to it, so for event very frequently published (like cellMouseLeave / cellMouseLeave) we have at least the cost of running publishEvent, but this seems pretty low (and cellMouseOver is called a lot more).

Could be worth exploring the performance cost if we want to add some of those events back, but the slotProps approach should work fine as well.

from mui-x.

github-actions avatar github-actions commented on May 28, 2024

The issue has been inactive for 7 days and has been automatically closed.

from mui-x.

romgrk avatar romgrk commented on May 28, 2024

I added the waiting-for-author tag because there was a question for @marcpachecog in my last comment, and the other comments pointed out good alternatives. Feel free to reopen.

from mui-x.

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.