fix: hot reloading

This commit is contained in:
cha0s 2020-06-26 03:22:40 -05:00
parent ef817def93
commit c86d2996e3
2 changed files with 22 additions and 0 deletions

View File

@ -2,6 +2,7 @@ import './app.scss';
import PropTypes from 'prop-types';
import React from 'react';
import {registerHooks} from 'scwp';
import {all} from './resources.scwp';
@ -29,3 +30,13 @@ Resource.propTypes = {
};
export default Resource;
if (module.hot) {
registerHooks({
autoreg$accept: (type) => {
if ('resource' === type) {
module.hot.invalidate();
}
},
}, module.id);
}

View File

@ -4,6 +4,7 @@ import {all as allTraitComponents} from '@avocado/entity/trait/trait-components.
import PropTypes from 'prop-types';
import React, {useMemo} from 'react';
import {useDispatch} from 'react-redux';
import {registerHooks} from 'scwp';
import Value from '~/client/value';
@ -94,3 +95,13 @@ TraitPane.propTypes = {
};
export default TraitPane;
if (module.hot) {
registerHooks({
autoreg$accept: (type, M) => {
if ('type-renderer' === type) {
module.hot.invalidate();
}
},
}, module.id);
}