mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 18:33:55 +00:00
shouldRefectchData delete
This commit is contained in:
parent
beda677349
commit
f70d2da3f8
@ -37,7 +37,6 @@ function EditView() {
|
||||
initialWebhook,
|
||||
isTriggering,
|
||||
triggerResponse,
|
||||
shouldRefetchData,
|
||||
} = reducerState.toJS();
|
||||
|
||||
const { name } = modifiedWebhook;
|
||||
@ -50,10 +49,10 @@ function EditView() {
|
||||
const { signal } = abortController;
|
||||
|
||||
useEffect(() => {
|
||||
if (!isCreating || (!isCreating && shouldRefetchData)) {
|
||||
if (!isCreating) {
|
||||
fetchData();
|
||||
}
|
||||
}, [fetchData, isCreating, shouldRefetchData]);
|
||||
}, [fetchData, isCreating]);
|
||||
|
||||
const fetchData = useCallback(async () => {
|
||||
try {
|
||||
@ -298,9 +297,8 @@ function EditView() {
|
||||
body,
|
||||
});
|
||||
|
||||
dispatch({
|
||||
type: 'SUBMIT_SUCCEEDED',
|
||||
});
|
||||
fetchData();
|
||||
|
||||
strapi.notification.error('notification.form.success.fields');
|
||||
} catch (err) {
|
||||
strapi.notification.error('notification.error');
|
||||
|
||||
@ -12,7 +12,6 @@ const initialState = fromJS({
|
||||
formErrors: {},
|
||||
initialWebhook: initialWebhook,
|
||||
modifiedWebhook: initialWebhook,
|
||||
shouldRefetchData: false,
|
||||
triggerResponse: {},
|
||||
isTriggering: false,
|
||||
});
|
||||
@ -36,8 +35,7 @@ const reducer = (state, action) => {
|
||||
|
||||
return state
|
||||
.update('initialWebhook', () => fromJS(data))
|
||||
.update('modifiedWebhook', () => fromJS(data))
|
||||
.update('shouldRefetchData', () => false);
|
||||
.update('modifiedWebhook', () => fromJS(data));
|
||||
}
|
||||
case 'TRIGGER_SUCCEEDED':
|
||||
return state
|
||||
@ -76,8 +74,6 @@ const reducer = (state, action) => {
|
||||
);
|
||||
case 'SET_ERRORS':
|
||||
return state.update('formErrors', () => fromJS(action.errors));
|
||||
case 'SUBMIT_SUCCEEDED':
|
||||
return state.update('shouldRefetchData', () => true);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user