Merge branch 'dev' of https://gitea.51mars.com/Oak-Team/oak-frontend-base into dev
This commit is contained in:
commit
1be6ad76c1
|
|
@ -250,6 +250,9 @@ class UpdateLogManager<ED extends EntityDict & BaseEntityDict, T extends keyof E
|
||||||
|
|
||||||
abstract class Node<ED extends EntityDict & BaseEntityDict> extends Feature {
|
abstract class Node<ED extends EntityDict & BaseEntityDict> extends Feature {
|
||||||
private zombie: boolean = false;
|
private zombie: boolean = false;
|
||||||
|
/**
|
||||||
|
* 当前有几个组件正在使用这个结点
|
||||||
|
*/
|
||||||
private count: number = 0;
|
private count: number = 0;
|
||||||
protected executing: boolean = false;
|
protected executing: boolean = false;
|
||||||
protected dirty?: boolean;
|
protected dirty?: boolean;
|
||||||
|
|
@ -2164,9 +2167,12 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
|
||||||
| VirtualNode<ED>
|
| VirtualNode<ED>
|
||||||
| undefined);
|
| undefined);
|
||||||
|
|
||||||
|
// 找到了之前的node,需要检查是否需要重用
|
||||||
if (node) {
|
if (node) {
|
||||||
if (node.getCount()) {
|
if (node.getCount()) { // 有组件正在使用
|
||||||
assert(!isPage || zombie, '暂时在路由上可能回归的页面必须设置为zombie');
|
// 页面组件已经被销毁,现在重新挂载,提示需要zombie
|
||||||
|
assert(!isPage || zombie, '暂时在路由上可能回归的页面必须设置为zombie'); // 是页面并且不是zombie
|
||||||
|
// 这次非virtualNode
|
||||||
if (entity) {
|
if (entity) {
|
||||||
if (node instanceof ListNode) {
|
if (node instanceof ListNode) {
|
||||||
if (isList && node.getEntity() === entity) {
|
if (isList && node.getEntity() === entity) {
|
||||||
|
|
@ -2191,8 +2197,8 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
assert(node instanceof SingleNode);
|
assert(node instanceof SingleNode, `节点[${path}]应为Virtual节点,但现在是[${entity.toString()}]请检查oakPath是否重复`);
|
||||||
assert(!isList && node.getEntity() === entity);
|
assert(!isList && node.getEntity() === entity, `节点${path}的entity为${node.getEntity().toString()},但现在为${entity.toString()},请检查oakPath是否重复`);
|
||||||
if (!node.getProjection() && projection) {
|
if (!node.getProjection() && projection) {
|
||||||
node.setProjection(projection);
|
node.setProjection(projection);
|
||||||
if (id) {
|
if (id) {
|
||||||
|
|
@ -2206,8 +2212,10 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 上次不是virtualNode,这次变成virtual了
|
||||||
else {
|
else {
|
||||||
assert(false, '这种情况暂时不考虑,跑出来再处理,by Xc 20240717');
|
assert(false, `创建Virtual节点时发现path[${fullPath}]已经存在有效的结点,请检查oakPath是否重复`);
|
||||||
|
// assert(false, '这种情况暂时不考虑,跑出来再处理,by Xc 20240717');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -2325,12 +2333,17 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
|
||||||
|
|
||||||
destroyNode(path: string, isPage: boolean) {
|
destroyNode(path: string, isPage: boolean) {
|
||||||
const node = this.findNode(path);
|
const node = this.findNode(path);
|
||||||
if (node) {
|
|
||||||
// 如果node不存在,说明父结点已经析构掉了,无视即可
|
// 如果node不存在,说明父结点已经析构掉了,无视即可
|
||||||
|
if (!node) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const cnt = node.decreaseCount();
|
const cnt = node.decreaseCount();
|
||||||
if (cnt === 0) {
|
if (cnt !== 0) {
|
||||||
const zombie = node.isZombie();
|
return;
|
||||||
if (!zombie) {
|
}
|
||||||
|
if (node.isZombie()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 不是声明为zombie结点就析构
|
// 不是声明为zombie结点就析构
|
||||||
const childPath = path.slice(path.lastIndexOf('.') + 1);
|
const childPath = path.slice(path.lastIndexOf('.') + 1);
|
||||||
const parent = node.getParent();
|
const parent = node.getParent();
|
||||||
|
|
@ -2343,9 +2356,6 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
|
||||||
node.destroy();
|
node.destroy();
|
||||||
node.clearSubscribes();
|
node.clearSubscribes();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
begin() {
|
begin() {
|
||||||
return this.cache.begin()!;
|
return this.cache.begin()!;
|
||||||
|
|
|
||||||
|
|
@ -730,8 +730,6 @@ export function destroyNode<
|
||||||
unset(this.state, ['oakFullpath', 'oakEntity']);
|
unset(this.state, ['oakFullpath', 'oakEntity']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export function getFreshValue<
|
export function getFreshValue<
|
||||||
ED extends EntityDict & BaseEntityDict,
|
ED extends EntityDict & BaseEntityDict,
|
||||||
T extends keyof ED
|
T extends keyof ED
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue