Skip to content

Commit 32ff72b

Browse files
committed
should warn if pure option is present
1 parent aa0bdc6 commit 32ff72b

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/components/connect.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ function connectFactory(defaults = {}, options = {}) {
3232
'However, this custom Request would only be used in the default buildRequest.'
3333
)
3434

35+
warning(options.pure === undefined, '`pure` option is no longer supported')
36+
3537
return connect(map, defaults, finalOptions)
3638
}
3739

test/components/connect.spec.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,6 @@ describe('React', () => {
12801280
expect(invocationCount).toEqual(2)
12811281
})
12821282

1283-
// TODO: clean up test
12841283
it('should deprecate mapPropsToRequestsToProps with context', () => {
12851284
let consoleSpy = expect.spyOn(console, 'error')
12861285

@@ -1370,6 +1369,25 @@ describe('React', () => {
13701369
])
13711370
})
13721371

1372+
it('should warn if pure option is present', () => {
1373+
let consoleSpy = expect.spyOn(console, 'error')
1374+
1375+
@connect.options({ pure: false })(() => {
1376+
return {}
1377+
})
1378+
class C extends Component {
1379+
render() {
1380+
return <div />
1381+
}
1382+
}
1383+
1384+
TestUtils.renderIntoDocument(
1385+
<C />
1386+
)
1387+
1388+
expect(consoleSpy.calls[0].arguments[0]).toEqual('Warning: `pure` option is no longer supported')
1389+
})
1390+
13731391
it('should shallowly compare the requests to prevent unnecessary fetches', (done) => {
13741392
@connect(({ foo }) => ({
13751393
testFetch: `/resource/${foo.FOO}`,

0 commit comments

Comments
 (0)