1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

fix: rename use of legacy react lifecyle methods

replaced with "UNSAFE_*" methods. Needs to be fixed at some point.
This commit is contained in:
Ivar Conradi Østhus 2020-04-18 21:50:01 +02:00
parent a3c6c8da37
commit 6e657314c2
10 changed files with 20 additions and 10 deletions

View File

@ -20,7 +20,8 @@ export default class FlexibleRolloutStrategy extends Component {
handleConfigChange: PropTypes.func.isRequired, handleConfigChange: PropTypes.func.isRequired,
}; };
componentWillMount() { // eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
const { strategy, featureToggleName } = this.props; const { strategy, featureToggleName } = this.props;
if (!strategy.parameters.rollout) { if (!strategy.parameters.rollout) {
this.setConfig('rollout', 100); this.setConfig('rollout', 100);

View File

@ -17,7 +17,8 @@ class CopyFeatureComponent extends Component {
this.state = { newToggleName: '', replaceGroupId: true }; this.state = { newToggleName: '', replaceGroupId: true };
} }
componentWillMount() { // eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
// TODO unwind this stuff // TODO unwind this stuff
if (this.props.copyToggle) { if (this.props.copyToggle) {
this.setState({ featureToggle: this.props.copyToggle }); this.setState({ featureToggle: this.props.copyToggle });

View File

@ -6,7 +6,8 @@ import { FormButtons } from './../../common';
class UpdateFeatureComponent extends Component { class UpdateFeatureComponent extends Component {
// static displayName = `UpdateFeatureComponent-{getDisplayName(Component)}`; // static displayName = `UpdateFeatureComponent-{getDisplayName(Component)}`;
componentWillMount() { // eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
// TODO unwind this stuff // TODO unwind this stuff
if (this.props.initCallRequired === true) { if (this.props.initCallRequired === true) {
this.props.init(this.props.input); this.props.init(this.props.input);

View File

@ -15,7 +15,8 @@ class StrategiesSectionComponent extends React.Component {
fetchStrategies: PropTypes.func, fetchStrategies: PropTypes.func,
}; };
componentWillMount() { // eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
this.props.fetchStrategies(); this.props.fetchStrategies();
} }

View File

@ -43,7 +43,8 @@ export default class MetricComponent extends React.Component {
location: PropTypes.object, location: PropTypes.object,
}; };
componentWillMount() { // eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
this.props.fetchSeenApps(); this.props.fetchSeenApps();
this.props.fetchFeatureMetrics(); this.props.fetchFeatureMetrics();
} }

View File

@ -24,7 +24,8 @@ class Progress extends Component {
} }
} }
componentWillReceiveProps({ percentage }) { // eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps({ percentage }) {
if (this.state.percentage !== percentage) { if (this.state.percentage !== percentage) {
const nextState = { percentage }; const nextState = { percentage };
if (this.props.animatePercentageText) { if (this.props.animatePercentageText) {

View File

@ -12,7 +12,8 @@ class UpdateVariantComponent extends Component {
super(props); super(props);
} }
componentWillMount() { // eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
// TODO unwind this stuff // TODO unwind this stuff
if (this.props.initCallRequired === true) { if (this.props.initCallRequired === true) {
this.props.init(this.props.input); this.props.init(this.props.input);

View File

@ -41,7 +41,8 @@ export default class ViewFeatureToggleComponent extends React.Component {
hasPermission: PropTypes.func.isRequired, hasPermission: PropTypes.func.isRequired,
}; };
componentWillMount() { // eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
if (this.props.features.length === 0) { if (this.props.features.length === 0) {
if (this.isFeatureView) { if (this.isFeatureView) {
this.props.fetchFeatureToggles(); this.props.fetchFeatureToggles();

View File

@ -22,7 +22,8 @@ class HeaderComponent extends PureComponent {
this.props.fetchContext(); this.props.fetchContext();
} }
componentWillReceiveProps(nextProps) { // eslint-disable-next-line camelcase
UNSAFE_componentWillReceiveProps(nextProps) {
if (this.props.location.pathname !== nextProps.location.pathname) { if (this.props.location.pathname !== nextProps.location.pathname) {
clearTimeout(this.timer); clearTimeout(this.timer);
this.timer = setTimeout(() => { this.timer = setTimeout(() => {

View File

@ -116,7 +116,8 @@ class AddStrategy extends Component {
init: PropTypes.func, init: PropTypes.func,
}; };
componentWillMount() { // eslint-disable-next-line camelcase
UNSAFE_componentWillMount() {
// TODO unwind this stuff // TODO unwind this stuff
if (this.props.initCallRequired === true) { if (this.props.initCallRequired === true) {
this.props.init(this.props.input); this.props.init(this.props.input);