intact-react
Advanced tools
Comparing version 3.0.33 to 3.0.34
@@ -0,1 +1,2 @@ | ||
import { Component } from './'; | ||
declare type Callback = () => void; | ||
@@ -21,2 +22,3 @@ declare type Executor = (resolve: () => void) => void; | ||
id: number; | ||
component: Component<any, any, any> | null; | ||
add(promise: FakePromise): void; | ||
@@ -23,0 +25,0 @@ reset(): void; |
@@ -74,2 +74,3 @@ 'use strict'; | ||
this.id = id++; | ||
this.component = null; | ||
} | ||
@@ -771,2 +772,3 @@ FakePromises.prototype.add = function (promise) { | ||
var promises = _this.$promises = new FakePromises(); | ||
promises.component = _this; | ||
{ | ||
@@ -918,8 +920,14 @@ promises.name = _this.constructor.name; | ||
}; | ||
var $parentPromises = this.$parentPromises; | ||
if ($parentPromises && !$parentPromises.done) { | ||
$parentPromises.add(new FakePromise(function (resolve) { | ||
var activeParentPromises = getActiveParentPromise(this); | ||
if (activeParentPromises) { | ||
activeParentPromises.add(new FakePromise(function (resolve) { | ||
done().then(resolve); | ||
})); | ||
} | ||
// const $parentPromises = this.$parentPromises; | ||
// if ($parentPromises && !$parentPromises.done) { | ||
// $parentPromises.add(new FakePromise(resolve => { | ||
// done().then(resolve); | ||
// })); | ||
// } | ||
else { | ||
@@ -968,9 +976,26 @@ done().then(function () { | ||
var mountedQueue = parent.$mountedQueue; | ||
var parentPromises = parent.$provides[PROMISES]; | ||
/** | ||
* should search all parent promises | ||
*/ | ||
var parentPromises = void 0; | ||
do { | ||
parentPromises = parent.$provides[PROMISES]; | ||
if (!parentPromises.done) { | ||
var children = mountedQueue.children || (mountedQueue.children = []); | ||
children.push(queue); | ||
break; | ||
} | ||
} while (parent = parentPromises.component.$senior); | ||
} | ||
return queue; | ||
} | ||
function getActiveParentPromise(component) { | ||
var parentPromises; | ||
while (parentPromises = component.$parentPromises) { | ||
if (!parentPromises.done) { | ||
var children = mountedQueue.children || (mountedQueue.children = []); | ||
children.push(queue); | ||
break; | ||
} | ||
component = parentPromises.component; | ||
} | ||
return queue; | ||
return parentPromises; | ||
} | ||
@@ -984,5 +1009,5 @@ function callMountedQueue(mountedQueue) { | ||
if (children) { | ||
children.forEach(function (mountedQueue) { | ||
callMountedQueue(mountedQueue); | ||
}); | ||
for (var i = 0; i < children.length; i++) { | ||
callMountedQueue(children[i]); | ||
} | ||
} | ||
@@ -989,0 +1014,0 @@ intact.callAll(mountedQueue); |
@@ -74,2 +74,3 @@ 'use strict'; | ||
this.id = id++; | ||
this.component = null; | ||
} | ||
@@ -757,2 +758,3 @@ FakePromises.prototype.add = function (promise) { | ||
var promises = _this.$promises = new FakePromises(); | ||
promises.component = _this; | ||
_this.$parentPromises = intact.inject(PROMISES, null); | ||
@@ -898,8 +900,14 @@ intact.provide(PROMISES, promises); | ||
}; | ||
var $parentPromises = this.$parentPromises; | ||
if ($parentPromises && !$parentPromises.done) { | ||
$parentPromises.add(new FakePromise(function (resolve) { | ||
var activeParentPromises = getActiveParentPromise(this); | ||
if (activeParentPromises) { | ||
activeParentPromises.add(new FakePromise(function (resolve) { | ||
done().then(resolve); | ||
})); | ||
} | ||
// const $parentPromises = this.$parentPromises; | ||
// if ($parentPromises && !$parentPromises.done) { | ||
// $parentPromises.add(new FakePromise(resolve => { | ||
// done().then(resolve); | ||
// })); | ||
// } | ||
else { | ||
@@ -948,9 +956,26 @@ done().then(function () { | ||
var mountedQueue = parent.$mountedQueue; | ||
var parentPromises = parent.$provides[PROMISES]; | ||
/** | ||
* should search all parent promises | ||
*/ | ||
var parentPromises = void 0; | ||
do { | ||
parentPromises = parent.$provides[PROMISES]; | ||
if (!parentPromises.done) { | ||
var children = mountedQueue.children || (mountedQueue.children = []); | ||
children.push(queue); | ||
break; | ||
} | ||
} while (parent = parentPromises.component.$senior); | ||
} | ||
return queue; | ||
} | ||
function getActiveParentPromise(component) { | ||
var parentPromises; | ||
while (parentPromises = component.$parentPromises) { | ||
if (!parentPromises.done) { | ||
var children = mountedQueue.children || (mountedQueue.children = []); | ||
children.push(queue); | ||
break; | ||
} | ||
component = parentPromises.component; | ||
} | ||
return queue; | ||
return parentPromises; | ||
} | ||
@@ -964,5 +989,5 @@ function callMountedQueue(mountedQueue) { | ||
if (children) { | ||
children.forEach(function (mountedQueue) { | ||
callMountedQueue(mountedQueue); | ||
}); | ||
for (var i = 0; i < children.length; i++) { | ||
callMountedQueue(children[i]); | ||
} | ||
} | ||
@@ -969,0 +994,0 @@ intact.callAll(mountedQueue); |
@@ -39,3 +39,3 @@ import { Component as IntactComponent, Props, VNodeComponentClass } from 'intact'; | ||
$reactProviders: Map<Provider<any>, any>; | ||
private $parentPromises; | ||
$parentPromises: FakePromises | null; | ||
private $elementRef; | ||
@@ -42,0 +42,0 @@ private $elementAlternateRef; |
@@ -71,2 +71,3 @@ import { __spreadArray, __assign, __extends } from 'tslib'; | ||
this.id = id++; | ||
this.component = null; | ||
} | ||
@@ -768,2 +769,3 @@ FakePromises.prototype.add = function (promise) { | ||
var promises = _this.$promises = new FakePromises(); | ||
promises.component = _this; | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -915,8 +917,14 @@ promises.name = _this.constructor.name; | ||
}; | ||
var $parentPromises = this.$parentPromises; | ||
if ($parentPromises && !$parentPromises.done) { | ||
$parentPromises.add(new FakePromise(function (resolve) { | ||
var activeParentPromises = getActiveParentPromise(this); | ||
if (activeParentPromises) { | ||
activeParentPromises.add(new FakePromise(function (resolve) { | ||
done().then(resolve); | ||
})); | ||
} | ||
// const $parentPromises = this.$parentPromises; | ||
// if ($parentPromises && !$parentPromises.done) { | ||
// $parentPromises.add(new FakePromise(resolve => { | ||
// done().then(resolve); | ||
// })); | ||
// } | ||
else { | ||
@@ -965,9 +973,26 @@ done().then(function () { | ||
var mountedQueue = parent.$mountedQueue; | ||
var parentPromises = parent.$provides[PROMISES]; | ||
/** | ||
* should search all parent promises | ||
*/ | ||
var parentPromises = void 0; | ||
do { | ||
parentPromises = parent.$provides[PROMISES]; | ||
if (!parentPromises.done) { | ||
var children = mountedQueue.children || (mountedQueue.children = []); | ||
children.push(queue); | ||
break; | ||
} | ||
} while (parent = parentPromises.component.$senior); | ||
} | ||
return queue; | ||
} | ||
function getActiveParentPromise(component) { | ||
var parentPromises; | ||
while (parentPromises = component.$parentPromises) { | ||
if (!parentPromises.done) { | ||
var children = mountedQueue.children || (mountedQueue.children = []); | ||
children.push(queue); | ||
break; | ||
} | ||
component = parentPromises.component; | ||
} | ||
return queue; | ||
return parentPromises; | ||
} | ||
@@ -981,5 +1006,5 @@ function callMountedQueue(mountedQueue) { | ||
if (children) { | ||
children.forEach(function (mountedQueue) { | ||
callMountedQueue(mountedQueue); | ||
}); | ||
for (var i = 0; i < children.length; i++) { | ||
callMountedQueue(children[i]); | ||
} | ||
} | ||
@@ -986,0 +1011,0 @@ callAll(mountedQueue); |
@@ -0,1 +1,2 @@ | ||
import { Component } from './'; | ||
declare type Callback = () => void; | ||
@@ -21,2 +22,3 @@ declare type Executor = (resolve: () => void) => void; | ||
id: number; | ||
component: Component<any, any, any> | null; | ||
add(promise: FakePromise): void; | ||
@@ -23,0 +25,0 @@ reset(): void; |
@@ -39,3 +39,3 @@ import { Component as IntactComponent, Props, VNodeComponentClass } from 'intact'; | ||
$reactProviders: Map<Provider<any>, any>; | ||
private $parentPromises; | ||
$parentPromises: FakePromises | null; | ||
private $elementRef; | ||
@@ -42,0 +42,0 @@ private $elementAlternateRef; |
{ | ||
"name": "intact-react", | ||
"version": "3.0.33", | ||
"version": "3.0.34", | ||
"description": "A compatibility layer for running intact component in React@17", | ||
@@ -32,6 +32,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"intact": "^3.0.33", | ||
"intact-shared": "^3.0.33", | ||
"intact": "^3.0.34", | ||
"intact-shared": "^3.0.34", | ||
"tslib": "^2.3.1" | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
1075825
25341
Updatedintact@^3.0.34
Updatedintact-shared@^3.0.34