diff --git a/src/editors/containers/EditorContainer/__snapshots__/index.test.jsx.snap b/src/editors/containers/EditorContainer/__snapshots__/index.test.jsx.snap index 8991786da..3241cf9a6 100644 --- a/src/editors/containers/EditorContainer/__snapshots__/index.test.jsx.snap +++ b/src/editors/containers/EditorContainer/__snapshots__/index.test.jsx.snap @@ -9,14 +9,7 @@ exports[`EditorContainer component render snapshot: initialized. enable save and close={[MockFunction closeCancelConfirmModal]} confirmAction={ diff --git a/src/editors/data/redux/thunkActions/app.js b/src/editors/data/redux/thunkActions/app.js index da5acf2c3..a10cf1db4 100644 --- a/src/editors/data/redux/thunkActions/app.js +++ b/src/editors/data/redux/thunkActions/app.js @@ -64,13 +64,13 @@ export const initialize = (data) => (dispatch) => { /** * @param {func} onSuccess */ -export const saveBlock = ({ content, returnToUnit }) => (dispatch) => { +export const saveBlock = (content, returnToUnit) => (dispatch) => { dispatch(actions.app.setBlockContent(content)); dispatch(requests.saveBlock({ content, onSuccess: (response) => { dispatch(actions.app.setSaveResponse(response)); - returnToUnit(response.data)(); + returnToUnit(response.data); }, })); }; diff --git a/src/editors/data/redux/thunkActions/app.test.js b/src/editors/data/redux/thunkActions/app.test.js index 5710071f9..289d0210a 100644 --- a/src/editors/data/redux/thunkActions/app.test.js +++ b/src/editors/data/redux/thunkActions/app.test.js @@ -138,8 +138,8 @@ describe('app thunkActions', () => { let returnToUnit; let calls; beforeEach(() => { - returnToUnit = jest.fn((response) => () => response); - thunkActions.saveBlock({ content: testValue, returnToUnit })(dispatch); + returnToUnit = jest.fn(); + thunkActions.saveBlock(testValue, returnToUnit)(dispatch); calls = dispatch.mock.calls; }); it('dispatches actions.app.setBlockContent with content, before dispatching saveBlock', () => { diff --git a/src/editors/hooks.js b/src/editors/hooks.js index 8ce7147ce..607dee772 100644 --- a/src/editors/hooks.js +++ b/src/editors/hooks.js @@ -54,15 +54,15 @@ export const saveBlock = ({ attemptSave = true; } if (attemptSave) { - dispatch(thunkActions.app.saveBlock({ - returnToUnit: module.navigateCallback({ + dispatch(thunkActions.app.saveBlock( + content, + module.navigateCallback({ destination, analyticsEvent: analyticsEvt.editorSaveClick, analytics, returnFunction, }), - content, - })); + )); } }; diff --git a/src/editors/hooks.test.jsx b/src/editors/hooks.test.jsx index df1545827..4a247a802 100644 --- a/src/editors/hooks.test.jsx +++ b/src/editors/hooks.test.jsx @@ -146,14 +146,14 @@ describe('hooks', () => { analytics, dispatch, }); - expect(dispatch).toHaveBeenCalledWith(thunkActions.app.saveBlock({ - returnToUnit: navigateCallback({ + expect(dispatch).toHaveBeenCalledWith(thunkActions.app.saveBlock( + content, + navigateCallback({ destination, analyticsEvent: analyticsEvt.editorSaveClick, analytics, }), - content, - })); + )); }); });