diff --git a/src/components/connect.js b/src/components/connect.js index d000041..db6b4cb 100644 --- a/src/components/connect.js +++ b/src/components/connect.js @@ -274,12 +274,7 @@ function connect(mapPropsToRequestsToProps, defaults, options) { const onRejection = this.createPromiseStateOnRejection(prop, mapping, startedAt) if (mapping.hasOwnProperty('value')) { - if (hasIn(mapping.value, 'then')) { - this.setAtomicState(prop, startedAt, mapping, initPS(meta)) - return mapping.value.then(onFulfillment(meta), onRejection(meta)) - } else { - return onFulfillment(meta)(mapping.value) - } + return onFulfillment(meta)(mapping.value) } else { const request = mapping.buildRequest(mapping) meta.request = request diff --git a/test/components/connect.spec.js b/test/components/connect.spec.js index feee655..81aebad 100644 --- a/test/components/connect.spec.js +++ b/test/components/connect.spec.js @@ -590,6 +590,36 @@ describe('React', () => { }) }) + it('should call then mappings with meta.component with value', (done) => { + const thenSpy = expect.createSpy() + const connectWithRef = connect.options({ withRef: true }) + + class Container extends Component { + render() { + return + } + } + + const DecoratedContainer = connectWithRef(() => ({ + someFetch: { + value: { random: 'value' }, + then: thenSpy + } + }))(Container) + + const decoratedContainer = TestUtils.renderIntoDocument( + + ) + + const container = TestUtils.findRenderedComponentWithType(decoratedContainer, Container) + + setImmediate(() => { + const meta = thenSpy.calls[0].arguments[1] + expect(thenSpy.calls[0]).toEqual(123) + done() + }) + }) + it('should call catch mappings', (done) => { const props = ({ baz: 42