From 761a9738e2dc52fb6b28011aaf7a0d00405b6f8b Mon Sep 17 00:00:00 2001 From: Aaron Contreras Date: Sun, 23 Apr 2017 16:16:06 +0200 Subject: [PATCH] Do not create new functions in render. Fix #66 --- src/components/connect-request.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/connect-request.js b/src/components/connect-request.js index 1a72ac93..fce45dda 100644 --- a/src/components/connect-request.js +++ b/src/components/connect-request.js @@ -31,6 +31,8 @@ const connectRequest = (mapPropsToConfigs, options = {}) => WrappedComponent => constructor() { super(); + this.forceRequest = this.forceRequest.bind(this); + // A set of URLs that identify all pending requests this._pendingRequests = {}; this._wrappedInstance = null; @@ -115,22 +117,23 @@ const connectRequest = (mapPropsToConfigs, options = {}) => WrappedComponent => } } - render() { - const configs = mapPropsToConfigs(this.props); - const forceRequest = partial(this.requestAsync.bind(this), configs, true, false); + forceRequest() { + this.requestAsync(mapPropsToConfigs(this.props), true, false); + } + render() { if (withRef) { return ( { this._wrappedInstance = ref; }} /> ); } else { - return ; + return ; } } }