This repository has been archived by the owner on Apr 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
components don't seem to be hot reloading changes to action creators #19
Comments
I should add, I am dynamically choosing whether to render a import React, {Component} from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import {connect} from 'react-redux';
import Alert from 'mindfront-react-components/bootstrap/Alert';
import viewTypes from 'viewTypes';
class ViewSwapper extends Component {
static propTypes = {
params: React.PropTypes.shape({
viewId: React.PropTypes.string.isRequired,
}).isRequired,
model: ImmutablePropTypes.shape({
type: React.PropTypes.string.isRequired,
}),
sessionState: React.PropTypes.object,
}
render() {
let {model, params: {viewId}} = this.props;
if (!model) {
return <Alert.Danger>
View {viewId} not found
</Alert.Danger>;
}
let viewType = viewTypes[model.get('type')];
if (viewType) {
return React.createElement(viewType.component, this.props);
}
return <Alert.Danger>
View settings for view {viewId} appear to be corrupted
</Alert.Danger>;
}
}
export default class ViewHolder extends Component {
static propTypes = {
params: React.PropTypes.shape({
viewId: React.PropTypes.string.isRequired,
}).isRequired,
}
selector = (state) => {
let viewId = this.props.params.viewId;
return {
model: state.getIn(['views', viewId]),
sessionState: state.getIn(['viewSessionStates', viewId]),
}
}
render() {
return React.createElement(connect(this.selector)(ViewSwapper), this.props, this.props.children);
}
} |
This is currently a limitation of |
Cool, thanks! |
You might be interested in reduxjs/redux#1455. |
Ah, I haven't used that preset, thanks for letting me know! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I have the following action in
actions.js
:It's used by
ReduxDashboardView.jsx
:Now if I add
console.log('test');
at the top ofreorderBlocks
and save, the browser appears to indicate that everything has been hot updated, yet when I trigger the action again, it doesn't print to console. But when I refresh the page and trigger the action again, it does print to console.I had assumed what would happen in this case is that the
react-transform-hmr
wrapper for the parent ofReduxDashboardView
ends up re-requiringReduxDashboardView.jsx
(which requires the newactions.js
in turn) and mounts a completely new<ReduxDashboardView>
that can call the newreorderBlocks
. But I'm guessing that's not what happens -- is it impossible forreact-transform-hmr
to hot reload in this case or am I doing something wrong?The text was updated successfully, but these errors were encountered: