isCreation的bug

This commit is contained in:
Xu Chang 2025-08-14 19:46:51 +08:00
parent a15a03cabd
commit 1c42b405ec
6 changed files with 12 additions and 33 deletions

View File

@ -443,13 +443,10 @@ const oakBehavior = Behavior({
return this.features.runningTree.remove(path2);
},
isCreation(path) {
const path2 = path
? `${this.state.oakFullpath}.${path}`
: this.state.oakFullpath;
// 调用getFreshValue不redo的情况下如果是creation返回应当是空
const value = this.getFreshValue(path2);
const value = this.getFreshValue(path);
assert(!(value instanceof Array));
return !value;
return value?.$$createAt$$ === 1;
},
async aggregate(aggregation) {
return await this.features.cache.aggregate(this.state.oakEntity, aggregation);

View File

@ -144,13 +144,9 @@ class OakComponentBase extends React.PureComponent {
this.features.runningTree.remove(path2);
}
isCreation(path) {
const path2 = path
? `${this.state.oakFullpath}.${path}`
: this.state.oakFullpath;
// 调用getFreshValue不redo的情况下如果是creation返回应当是空
const value = this.getFreshValue(path2);
const value = this.getFreshValue(path);
assert(!(value instanceof Array));
return !value;
return value?.$$createAt$$ === 1;
}
clean(lsn, dontPublish, path) {
const path2 = path

View File

@ -446,13 +446,10 @@ const oakBehavior = Behavior({
return this.features.runningTree.remove(path2);
},
isCreation(path) {
const path2 = path
? `${this.state.oakFullpath}.${path}`
: this.state.oakFullpath;
// 调用getFreshValue不redo的情况下如果是creation返回应当是空
const value = this.getFreshValue(path2);
const value = this.getFreshValue(path);
(0, assert_1.assert)(!(value instanceof Array));
return !value;
return value?.$$createAt$$ === 1;
},
async aggregate(aggregation) {
return await this.features.cache.aggregate(this.state.oakEntity, aggregation);

View File

@ -149,13 +149,9 @@ class OakComponentBase extends react_1.default.PureComponent {
this.features.runningTree.remove(path2);
}
isCreation(path) {
const path2 = path
? `${this.state.oakFullpath}.${path}`
: this.state.oakFullpath;
// 调用getFreshValue不redo的情况下如果是creation返回应当是空
const value = this.getFreshValue(path2);
const value = this.getFreshValue(path);
(0, assert_1.assert)(!(value instanceof Array));
return !value;
return value?.$$createAt$$ === 1;
}
clean(lsn, dontPublish, path) {
const path2 = path

View File

@ -653,14 +653,11 @@ const oakBehavior = Behavior<
},
isCreation(path) {
const path2 = path
? `${this.state.oakFullpath}.${path}`
: this.state.oakFullpath;
// 调用getFreshValue不redo的情况下如果是creation返回应当是空
const value = this.getFreshValue(path2);
const value = this.getFreshValue(path);
assert(!(value instanceof Array));
return !value;
return value?.$$createAt$$ as number === 1;
},
async aggregate(aggregation) {

View File

@ -303,14 +303,10 @@ abstract class OakComponentBase<
}
isCreation(path?: string) {
const path2 = path
? `${this.state.oakFullpath}.${path}`
: this.state.oakFullpath;
// 调用getFreshValue不redo的情况下如果是creation返回应当是空
const value = this.getFreshValue(path2);
const value = this.getFreshValue(path);
assert(!(value instanceof Array));
return !value;
return value?.$$createAt$$ as number === 1;
}
clean(lsn?: number, dontPublish?: true, path?: string) {