Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Gannaway authored and Dominic Gannaway committed Feb 1, 2017
1 parent a8a4434 commit 9f02587
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5,936 deletions.
3 changes: 2 additions & 1 deletion packages/inferno-component/src/index.ts
Expand Up @@ -174,6 +174,7 @@ export default class Component<P, S> implements ComponentLifecycle<P, S> {
_blockSetState = false;
_deferSetState = false;
_pendingSetState = false;
_syncSetState = true;
_pendingState = {};
_lastInput = null;
_vNode = null;
Expand Down Expand Up @@ -208,7 +209,7 @@ export default class Component<P, S> implements ComponentLifecycle<P, S> {
}
if (!this._blockSetState) {
if (!this._ignoreSetState) {
queueStateChanges(this, newState, callback, false);
queueStateChanges(this, newState, callback, this._syncSetState);
}
} else {
if (process.env.NODE_ENV !== 'production') {
Expand Down
3 changes: 3 additions & 0 deletions packages/inferno/src/DOM/mounting.ts
Expand Up @@ -235,7 +235,10 @@ export function mountClassComponentCallbacks(vNode: VNode, ref, instance, lifecy
lifecycle.addListener(() => {
afterMount && afterMount(vNode);
cDM && instance.componentDidMount();
instance._syncSetState = true;
});
} else {
instance._syncSetState = true;
}
}

Expand Down
2 changes: 2 additions & 0 deletions packages/inferno/src/DOM/patching.ts
Expand Up @@ -342,6 +342,7 @@ export function patchComponent(lastVNode, nextVNode, parentDom, lifecycle: Lifec

nextVNode.children = instance;
instance._isSVG = isSVG;
instance._syncSetState = false;
if (!isNullOrUndef(childContext)) {
childContext = Object.assign({}, context, childContext);
} else {
Expand Down Expand Up @@ -386,6 +387,7 @@ export function patchComponent(lastVNode, nextVNode, parentDom, lifecycle: Lifec
options.afterUpdate && options.afterUpdate(nextVNode);
options.findDOMNodeEnabled && componentToDOMNodeMap.set(instance, nextInput.dom);
}
instance._syncSetState = true;
nextVNode.dom = nextInput.dom;
}
} else {
Expand Down

0 comments on commit 9f02587

Please sign in to comment.