Giter Club home page Giter Club logo

Comments (6)

mweststrate avatar mweststrate commented on August 15, 2024 1

Made a change where using the propTypes provided by mobx-react will use untracked. This doesn't solve it for the general case though. Either using typescript πŸ˜‰, or production will avoid this issue. So since this is only a dev problem, a further won't fix for now.

from mobx-react.

sgoll avatar sgoll commented on August 15, 2024

I don't think you are doing anything wrong: React does prop type checking in the parent component (in order to output meaningful error messages such as "Check render() method of component X").

These prop type checks result in these observables being reported observed, i.e. they are added as extra dependencies of the parent component (in addition to the child component).

I stumbled upon this issue myself a couple of days ago. Unfortunately, I don't have a solution for this.

It makes using the mobx-react devtools harder because parent components show as changed as well. It also hurts performance somewhat, since two re-renders have to happen: one for the actual component and one for the parent which only accidentally is added as observer (only due to prop type checking).

from mobx-react.

mattruby avatar mattruby commented on August 15, 2024

Will this be an issue running the prod build of React? I thought React only checks against the propTypes in dev mode?

from mobx-react.

mweststrate avatar mweststrate commented on August 15, 2024

See also mobxjs/mobx#305

from mobx-react.

mweststrate avatar mweststrate commented on August 15, 2024

I think this can be circumvented by having mobx-react provide it's own propTypes, that leverage mobx.untracked, will investigate

from mobx-react.

vkartaviy avatar vkartaviy commented on August 15, 2024

Stumbled upon this issue today when used PropTypes.arrayOf() :(

from mobx-react.

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.