Coder Social home page Coder Social logo

Comments (7)

driskell avatar driskell commented on May 29, 2024

Location in Atom module cache code where this module is skipped is:

https://github.com/atom/atom/blob/master/src/module-cache.coffee#L101

from reactionary.

driskell avatar driskell commented on May 29, 2024

Hi @nathansobo - sorry for the ping - is this something due to be looked at? Or should git-blame cease using it?

from reactionary.

nathansobo avatar nathansobo commented on May 29, 2024

I don't think you should use it. It's designed to be used with a React dependency from the parent application. But it's a tiny wrapper and you could just copy and paste the pieces of it that are useful to you and move on. There are also JSX extensions for CoffeeScript now, which might be worth a look.

from reactionary.

driskell avatar driskell commented on May 29, 2024

Thanks @nathansobo - so is that to say, the missing dependency will not be added, and this project is closed?

from reactionary.

nathansobo avatar nathansobo commented on May 29, 2024

The dependency is left out intentionally so you can use whatever version of React you want by including React as a sibling dependency of this library in your project. It will look upward to the parent directory and find it. But, yeah, I also won't really be maintaining this library. There's not much to it though so if you manage the dependency as I described, it should work fine.

from reactionary.

driskell avatar driskell commented on May 29, 2024

@nathansobo The problem, however, is when used in an Atom package. I'm curious on your thoughts on this!

When used as an Atom package, Atom sees it has zero dependencies and does not log its path in the paths that should use the Atom module cache. So all require calls (which Atom assumes it never does) will bypass the module cache.

Problem begins because Atom has react. So when module cache is hit for a package, even though the package might have its own react in its node_modules, the Atom module cache kicks in and returns the same one Atom uses. Makes sense, as it prevents duplication.

However, when reactionary calls require - because its path is not in the module cache paths (because Atom thinks it doesn't need to as it doesn't have any dependencies) - the call to require bypasses the module cache, and iterates upwards - eventually hitting the react in the package's own node_modules. Chances are these are identical versions.

Now we have two instances of react loaded. The Atom instance. The package instance. Both same version.

Package then uses reactionary and actually reactionary returns components that are created using instances of a different React to that which Atom and the package itself is using. So essentially the reactionary values are not compatible - react in render() checks the result is "instanceof" something - and this check fails - it's an "instanceof" the right thing but the wrong instance.

from reactionary.

nathansobo avatar nathansobo commented on May 29, 2024

I'd recommend copying and pasting the code from this library into your package as a workaround for now if you still want to use the syntactic sugar it provides.

from reactionary.

Related Issues (1)

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.