{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react/issues/1965","repository_url":"https://api.github.com/repos/facebook/react","labels_url":"https://api.github.com/repos/facebook/react/issues/1965/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react/issues/1965/comments","events_url":"https://api.github.com/repos/facebook/react/issues/1965/events","html_url":"https://github.com/facebook/react/pull/1965","id":39143286,"number":1965,"title":"Refactor composite component update flow","user":{"login":"spicyj","id":6820,"avatar_url":"https://avatars.githubusercontent.com/u/6820?v=3","gravatar_id":"","url":"https://api.github.com/users/spicyj","html_url":"https://github.com/spicyj","followers_url":"https://api.github.com/users/spicyj/followers","following_url":"https://api.github.com/users/spicyj/following{/other_user}","gists_url":"https://api.github.com/users/spicyj/gists{/gist_id}","starred_url":"https://api.github.com/users/spicyj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spicyj/subscriptions","organizations_url":"https://api.github.com/users/spicyj/orgs","repos_url":"https://api.github.com/users/spicyj/repos","events_url":"https://api.github.com/users/spicyj/events{/privacy}","received_events_url":"https://api.github.com/users/spicyj/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/react/labels/GH%20Review:%20accepted","name":"GH Review: accepted","color":"009800"},{"url":"https://api.github.com/repos/facebook/react/labels/GH%20Review:%20shipped","name":"GH Review: shipped","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-07-30T22:17:58Z","updated_at":"2016-04-28T20:19:22Z","closed_at":"2014-10-23T01:01:30Z","pull_request":{"url":"https://api.github.com/repos/facebook/react/pulls/1965","html_url":"https://github.com/facebook/react/pull/1965","diff_url":"https://github.com/facebook/react/pull/1965.diff","patch_url":"https://github.com/facebook/react/pull/1965.patch"},"body":"Fixes #1392.\n\nPreviously, ReactComponent.updateComponent set the new props and owner and updated the component's refs. Because it did the actual props assignment, it had to be called by ReactCompositeComponent between componentWillMount and componentDidMount, meaning that it was skipped if shouldComponentUpdate returned false. Now, updateComponent takes the old and new descriptors and only updates refs, allowing a subclass to call updateComponent at a convenient time (specifically, it can be before `this._descriptor` is updated if the subclass also overrides performUpdateIfNecessary).\n\nThe new update cycle for composites is:\n\n- receiveComponent is called which stores `this._pendingDescriptor` and calls performUpdateIfNecessary directly or a state update is enqueued, in which case ReactUpdates will call performUpdateIfNecessary\n- performUpdateIfNecessary ensures that an update is still pending (which might no longer be the case if an update is queued for a subcomponent that was updated through a parent's reconciliation) and calls updateComponent with the old and new descriptors\n- updateComponent calls super to update refs, then calls componentWillReceiveProps (if applicable) and shouldComponentUpdate -- if shouldComponentUpdate returns false, `this._descriptor`, `this.props`, and `this.state` are updated and the update is skipped; else, _performComponentUpdate is called\n- _performComponentUpdate calls componentWillUpdate and _updateRenderedComponent, and enqueues the componentDidUpdate call (in that order)\n- _updateRenderedComponent calls render and updates the rendered component appropriately\n\nFor DOM components (essentially unchanged):\n\n- receiveComponent is called which does a short-circuit check for descriptor equality and delegates to super (which stores `this._pendingDescriptor` and calls performUpdateIfNecessary)\n- performUpdateIfNecessary (not overridden) sets new values for `this.props`, etc. and calls updateComponent\n- updateComponent does the DOM property and children updates (some synchronously, some queued for the transaction close)\n\nFor text and ART components (unchanged):\n\n- receiveComponent updates the DOM or ART directly based on the new props\n- updateComponent is never called\n\nNotable changes:\n\n- When shouldComponentUpdate returns false, refs are still updated\n- ReactDefaultPerf now includes lifecycle methods in component timings\n- updateComponent's signature changed (technically this is part of the public API, though we've never documented it)\n\nTest Plan: jest"},"comment":{"url":"https://api.github.com/repos/facebook/react/issues/comments/215549765","html_url":"https://github.com/facebook/react/pull/1965#issuecomment-215549765","issue_url":"https://api.github.com/repos/facebook/react/issues/1965","id":215549765,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars.githubusercontent.com/u/2354108?v=3","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2016-04-28T20:19:22Z","updated_at":"2016-04-28T20:19:22Z","body":"\n[![Coverage Status](https://coveralls.io/builds/5976423/badge)](https://coveralls.io/builds/5976423)\n\nChanges Unknown when pulling **de1dacdb2887349d09b839bb79d008ae0bf057b0 on spicyj:scu-false-refs-2** into ** on facebook:master**.\n"}}