diff --git a/src/actions/prepareComponent.js b/src/actions/prepareComponent.js index b0aeec7..9809bc1 100644 --- a/src/actions/prepareComponent.js +++ b/src/actions/prepareComponent.js @@ -54,12 +54,6 @@ export default (Component, props = {}) => (dispatch, getState) => { const prepareKey = getPrepareKey(componentId, initValues); - if (!initAction && initActionClient) { - console.warn( - `Redundant call to prepareComponent() with component "${componentId}". Initialization is client-only, so preparing is not neccessary`, - ); - } - return dispatch( initComponent(Component, initValues, prepareKey, { caller: 'prepareComponent', diff --git a/tests/actions/prepareComponent.spec.js b/tests/actions/prepareComponent.spec.js index 735a786..52c378f 100644 --- a/tests/actions/prepareComponent.spec.js +++ b/tests/actions/prepareComponent.spec.js @@ -171,42 +171,4 @@ describe('prepareComponent', () => { expect(actions).toEqual([]); })); }); - - it('warns the user about redundant calls with clientOnly initAction components', () => { - clearComponentIds(); - const store = mockStore(modePrepareAndNothingPrepared); - const mockInitActionClient = jest.fn(() => Promise.resolve()); - const MockWithInit = withInitAction( - { - clientOnly: mockInitActionClient, - }, - )(SimpleInitTestComponent); - const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {}); - - const preparePromise = store.dispatch(prepareComponent(MockWithInit, {})); - return preparePromise.then(() => { - expect(consoleWarnSpy).toHaveBeenCalled(); - consoleWarnSpy.mockRestore(); - }); - }); - - it('does not warn the user if there is a prepared action', () => { - clearComponentIds(); - const store = mockStore(modePrepareAndNothingPrepared); - const mockInitActionPrepared = jest.fn(() => Promise.resolve()); - const mockInitActionClient = jest.fn(() => Promise.resolve()); - const MockWithInit = withInitAction( - { - prepared: mockInitActionPrepared, - clientOnly: mockInitActionClient, - }, - )(SimpleInitTestComponent); - const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementation(() => {}); - - const preparePromise = store.dispatch(prepareComponent(MockWithInit, {})); - return preparePromise.then(() => { - expect(consoleWarnSpy).not.toHaveBeenCalled(); - consoleWarnSpy.mockRestore(); - }); - }); });