webpack/scenes/ContentViews/Copy/CopyContentViewForm.js in katello-4.1.4 vs webpack/scenes/ContentViews/Copy/CopyContentViewForm.js in katello-4.2.0.rc1
- old
+ new
@@ -1,7 +1,8 @@
import { STATUS } from 'foremanReact/constants';
-import React, { useState, useEffect } from 'react';
+import React, { useState } from 'react';
+import useDeepCompareEffect from 'use-deep-compare-effect';
import PropTypes from 'prop-types';
import { useDispatch, useSelector } from 'react-redux';
import { Redirect } from 'react-router-dom';
import { Form, FormGroup, TextInput, ActionGroup, Button } from '@patternfly/react-core';
import {
@@ -17,18 +18,18 @@
const [saving, setSaving] = useState(false);
const response = useSelector(selectCopyContentViews);
const status = useSelector(selectCopyContentViewStatus);
const error = useSelector(selectCopyContentViewError);
- useEffect(() => {
+ useDeepCompareEffect(() => {
const { id } = response;
if (id && status === STATUS.RESOLVED) {
setSaving(false);
setRedirect(true);
} else if (status === STATUS.ERROR) {
setSaving(false);
}
- }, [JSON.stringify(response), status, error]);
+ }, [response, status, error]);
const onSubmit = () => {
setSaving(true);
dispatch(copyContentView({
id: cvId,