Skip to content

Commit

Permalink
fixed #93
Browse files Browse the repository at this point in the history
  • Loading branch information
古映杰 committed Jan 19, 2017
1 parent 8b738af commit 860a6d1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 9 deletions.
9 changes: 7 additions & 2 deletions dist/react-lite.common.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* react-lite.js v0.15.30
* (c) 2016 Jade Gu
* react-lite.js v0.15.31
* (c) 2017 Jade Gu
* Released under the MIT License.
*/
'use strict';
Expand Down Expand Up @@ -785,6 +785,11 @@ Component.prototype = {
if (!$cache.isMounted) {
return;
}
// if updater is pending, add state to trigger nexttick update
if ($updater.isPending) {
$updater.addState(state);
return;
}
var nextProps = $cache.props || props;
var nextState = $cache.state || state;
var nextContext = $cache.context || context;
Expand Down
9 changes: 7 additions & 2 deletions dist/react-lite.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* react-lite.js v0.15.30
* (c) 2016 Jade Gu
* react-lite.js v0.15.31
* (c) 2017 Jade Gu
* Released under the MIT License.
*/
(function (global, factory) {
Expand Down Expand Up @@ -789,6 +789,11 @@
if (!$cache.isMounted) {
return;
}
// if updater is pending, add state to trigger nexttick update
if ($updater.isPending) {
$updater.addState(state);
return;
}
var nextProps = $cache.props || props;
var nextState = $cache.state || state;
var nextContext = $cache.context || context;
Expand Down
6 changes: 3 additions & 3 deletions dist/react-lite.min.js

Large diffs are not rendered by default.

Binary file modified dist/react-lite.min.js.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-lite",
"version": "0.15.30",
"version": "0.15.31",
"description": "an implementation of React that optimizes for small script size",
"main": "dist/react-lite.common.js",
"jsnext:main": "src/index.js",
Expand Down
7 changes: 6 additions & 1 deletion src/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,14 @@ Component.prototype = {
// },
forceUpdate(callback) {
let { $updater, $cache, props, state, context } = this
if ($updater.isPending || !$cache.isMounted) {
if (!$cache.isMounted) {
return
}
// if updater is pending, add state to trigger nexttick update
if ($updater.isPending) {
$updater.addState(state)
return;
}
let nextProps = $cache.props || props
let nextState = $cache.state || state
let nextContext = $cache.context || context
Expand Down

0 comments on commit 860a6d1

Please sign in to comment.