-
Notifications
You must be signed in to change notification settings - Fork 57
Hot loading doesn't work when using Relay #22
Comments
My project is closed-source, so I can't share the code. Maybe I'll try to whip up an example |
Please create a minimal reproducing example. |
Okay, I got it working.. the problem in my case was that I was specifying the query.plugins with I'll let you know if I run into anything else, but for now I'm closing this. |
@gaearon I seem to have the same problem. fortruce/relay-skeleton#1 seems to suggest that hot reload works only for exported components, but not for exported Relay containers wrapping the former. Is that the case? And if so, do you have any suggestions on how to deal with that? Thank you :) |
I don't have a good solution right now. Hopefully we'll have something that detects any kind of component by the end of this year. |
App.js: export class AppComponent extends Component {
render() {
return <h1>Plain Old React Component</h1>
}
}
const App = Relay.createContainer(AppComponent, {...});
export default App; index.js: import App, {AppComponent} from './App'; I am using the above pattern. HMR works like a charm. Of course, when working with Relay, this would suffice: import App from './App'; Without Relay, in a normal Ract app, I'd write this: import {AppComponent} from './App'; |
Actually, I do have a solution now: gaearon/react-hot-boilerplate#61. Not sure whether it works with Relay, but I don’t see why not. |
@laszbalo that works indeed, very clever (except that I now get annoying linter warnings about the unused import) – looking forward to v3 though! |
@skosch in the above example that App module exports two things:
If you are using Relay, you probably want to import only the App component from the App module. Hence there should be no linter warnings. |
(issue moved from gaearon/babel-plugin-react-transform#39)
Since I started using Relay, hot loading always gives the error
The issue is also mentioned in fortruce/relay-skeleton#1, but I don't think that solution is a good way to go.
The text was updated successfully, but these errors were encountered: