Giter VIP home page Giter VIP logo

Comments (5)

gaearon avatar gaearon commented on April 30, 2024

This will probably be solved by #26 when it's implemented.

Can you please say whether it works with React Hot Loader?

from babel-plugin-react-transform.

BerndWessels avatar BerndWessels commented on April 30, 2024

@gaearon It didn't work for me. I hope your big rewrite for babel 6 compatibility will fix this issue too.
Thanks
Bernd

from babel-plugin-react-transform.

cesarandreu avatar cesarandreu commented on April 30, 2024

As a quick hack, I changed getDisplayName to:

  function getDisplayName(node) {
    if (node.arguments[0].properties) {
      const property = find(node.arguments[0].properties, node => node.key.name === 'displayName');
      return property && property.value.value;
    } else {
      return node.arguments[0].name;
    }
  }

And I updated my babel plugin config with the following:

[
  "react-transform",
  {
    "transforms": [
      {
        "transform": "react-transform-hmr",
        "imports": [
          "react"
        ],
        "locals": [
          "module"
        ]
      }
    ],
    "factoryMethods": ["React.createClass", "Relay.createContainer"]
  }
]

This makes it so hotloading will work when using Relay. It won't reload your fragments and re-fetch data... But it enables you to at least iterate on components, so I'd view it as an improvement.

from babel-plugin-react-transform.

gaearon avatar gaearon commented on April 30, 2024

I’m curious whether the approach from reduxjs/redux#1455 might help here. Namely, just nuke your components and mount new versions of them without React Transform altogether.

from babel-plugin-react-transform.

gaearon avatar gaearon commented on April 30, 2024

@BerndWessels

Thanks again for raising this.
I’m closing because you have several options:

  • try the workaround I described in #45 (comment)
  • wait for some solution to #26 which looks like one possible cause of this issue
  • take the time to dive in, figure out why it doesn’t work, and maybe contribute that support 😉

I don’t plan to personally work on this in near term but I don’t see why it couldn’t be made to work given some effort.

@cesarandreu

This makes it so hotloading will work when using Relay. It won't reload your fragments and re-fetch data... But it enables you to at least iterate on components, so I'd view it as an improvement.

I’m rather confused. Babel plugin should find the inner component and force its re-rendering on changes regardless of whether it is wrapped in a Relay container or anything else. Is this not the case? Would you like to investigate why?

from babel-plugin-react-transform.

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.