From 9bac8937409b2b52512ac168f3ff8d0cea485a6a Mon Sep 17 00:00:00 2001 From: Douglas Brown Date: Thu, 13 Oct 2016 15:17:43 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=20Remove=20ill-considered=20lif?= =?UTF-8?q?ecycle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'componentWillReceiveProps' lifecycle method wasn't well considered, and presents considerable problems when manually adding/setting streams. It's better to remove this and leave this kind of implimentation in userland. --- package.json | 2 +- src/index.js | 25 ------------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/package.json b/package.json index cf043a6..2d652f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-flyd-component", - "version": "2.0.0", + "version": "2.1.0", "description": "Live-Updating Stateless React Components Using Flyd", "main": "lib/index.js", "scripts": { diff --git a/src/index.js b/src/index.js index ff5c387..a0c76e2 100644 --- a/src/index.js +++ b/src/index.js @@ -27,31 +27,6 @@ export class StreamingComponent extends Component { this._onUpdate = combine(this.onStreamUpdate.bind(this)); } - /** - * componentWillReceiveProps - * - * Handles changes to props for this component - * (but only where streams are added or removed). - * - * Built-in React lifecylce. - * - * @param {Object} nextProps - * @returns {void} - */ - componentWillReceiveProps(nextProps) { - const newStreams = getStreamsFromProps(nextProps); - - // it doesn't make much sense that streams would - // be conditionally present, but hey who am I to judge. - // this will clearly not automatically update if two streams - // are swapped-out (length is equal but streams are different). - // that's what `clearStreams` is for, so it should be - // invoked manually if you try that junk. *wontfix* - if (newStreams.length !== this._streams.length) { - this.clearStreams(newStreams); - } - } - /** * componentWillMount *