From 95b1555c13fc6091d829ec9e054dbe81f9db3e8e Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 24 Apr 2018 22:42:51 -0700 Subject: [PATCH 1/4] Ensure tests are linted appropriately --- test/.eslintrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/.eslintrc b/test/.eslintrc index 83e8b92..906c2f5 100644 --- a/test/.eslintrc +++ b/test/.eslintrc @@ -1,4 +1,7 @@ { + "extends": [ + "../.eslintrc" + ], "env": { "jest": true, "node": true From 55eef6c9238bcc4d412d808372966ab2af5af0f7 Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 24 Apr 2018 22:42:54 -0700 Subject: [PATCH 2/4] Ensure lazy is computed with current props --- src/fetch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fetch.js b/src/fetch.js index 7ea2f17..8a114c6 100644 --- a/src/fetch.js +++ b/src/fetch.js @@ -121,7 +121,7 @@ export class Fetch extends React.Component { method: prevProps.method.toUpperCase() }); - if (currentRequestKey !== prevRequestKey && !this.isLazy(prevProps)) { + if (currentRequestKey !== prevRequestKey && !this.isLazy()) { this.fetchData({ requestKey: currentRequestKey }); From 1ffdcefaf0108a409db717c19291d9aa1caa3ed2 Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 24 Apr 2018 22:47:19 -0700 Subject: [PATCH 3/4] Simplify isLazy function --- src/fetch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fetch.js b/src/fetch.js index 8a114c6..7166045 100644 --- a/src/fetch.js +++ b/src/fetch.js @@ -74,8 +74,8 @@ export class Fetch extends React.Component { // We default to being lazy for "write" requests, // such as POST, PATCH, DELETE, and so on. - isLazy = props => { - const { lazy, method } = props || this.props; + isLazy = () => { + const { lazy, method } = this.props; return typeof lazy === 'undefined' ? !this.isReadRequest(method) : lazy; }; From 1a24d6ac0eb474b53253a0cb21f60bbfa44b7054 Mon Sep 17 00:00:00 2001 From: James Smith Date: Tue, 24 Apr 2018 22:44:18 -0700 Subject: [PATCH 4/4] 3.0.1 --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8be3f6d..fc1972d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### v3.0.1 (2018/4/24) + +**Bug Fixes** + +* Fixes a bug where `isLazy` would sometimes be computed using previous + props rather than the current props. + ### v3.0.0 (2018/4/24) > Although the changes in this release are technically breaking, they are unlikely to diff --git a/package.json b/package.json index d5970ba..d405b8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-request", - "version": "3.0.0", + "version": "3.0.1", "description": "Declarative HTTP requests with React.", "main": "lib/index.js", "module": "es/index.js",