ComponentOption中增加了stale配置项

This commit is contained in:
Xu Chang 2024-12-10 19:01:59 +08:00
parent 41254e9304
commit 57ebc434ba
9 changed files with 33 additions and 12 deletions

View File

@ -482,7 +482,7 @@ const oakBehavior = Behavior({
this.oakOption.lifetimes?.ready &&
this.oakOption.lifetimes?.ready.call(this);
const { oakFullpath } = this.state;
if (oakFullpath &&
if (oakFullpath && !this.oakOption.stale &&
!this.features.runningTree.checkIsModiNode(oakFullpath) &&
!this.features.runningTree.isListDescandent(oakFullpath)) {
this.refresh();
@ -787,7 +787,9 @@ export function createComponent(option, features) {
return;
}
const { oakFullpath } = this.state;
if (oakFullpath && !features.runningTree.checkIsModiNode(oakFullpath) && !features.runningTree.isListDescandent(oakFullpath)) {
if (oakFullpath && !option.stale &&
!features.runningTree.checkIsModiNode(oakFullpath) &&
!features.runningTree.isListDescandent(oakFullpath)) {
try {
await this.refresh();
}

View File

@ -643,7 +643,9 @@ export function createComponent(option, features) {
}
try {
const { oakFullpath } = this.state;
if (oakFullpath && !features.runningTree.checkIsModiNode(oakFullpath) && !features.runningTree.isListDescandent(oakFullpath)) {
if (oakFullpath && !option.stale &&
!features.runningTree.checkIsModiNode(oakFullpath) &&
!features.runningTree.isListDescandent(oakFullpath)) {
await this.refresh();
}
else {
@ -701,7 +703,9 @@ export function createComponent(option, features) {
lifetimes?.show && lifetimes.show.call(this);
}
const { oakFullpath } = this.state;
if (oakFullpath && !features.runningTree.checkIsModiNode(oakFullpath) && !features.runningTree.isListDescandent(oakFullpath)) {
if (oakFullpath && !option.stale &&
!features.runningTree.checkIsModiNode(oakFullpath) &&
!features.runningTree.isListDescandent(oakFullpath)) {
this.refresh();
}
else {

1
es/types/Page.d.ts vendored
View File

@ -41,6 +41,7 @@ interface ComponentOption<IsList extends boolean, ED extends EntityDict & BaseEn
*
*/
isList?: IsList;
stale?: boolean;
zombie?: true;
getTotal?: {
max: number;

View File

@ -485,7 +485,7 @@ const oakBehavior = Behavior({
this.oakOption.lifetimes?.ready &&
this.oakOption.lifetimes?.ready.call(this);
const { oakFullpath } = this.state;
if (oakFullpath &&
if (oakFullpath && !this.oakOption.stale &&
!this.features.runningTree.checkIsModiNode(oakFullpath) &&
!this.features.runningTree.isListDescandent(oakFullpath)) {
this.refresh();
@ -790,7 +790,9 @@ function createComponent(option, features) {
return;
}
const { oakFullpath } = this.state;
if (oakFullpath && !features.runningTree.checkIsModiNode(oakFullpath) && !features.runningTree.isListDescandent(oakFullpath)) {
if (oakFullpath && !option.stale &&
!features.runningTree.checkIsModiNode(oakFullpath) &&
!features.runningTree.isListDescandent(oakFullpath)) {
try {
await this.refresh();
}

View File

@ -648,7 +648,9 @@ function createComponent(option, features) {
}
try {
const { oakFullpath } = this.state;
if (oakFullpath && !features.runningTree.checkIsModiNode(oakFullpath) && !features.runningTree.isListDescandent(oakFullpath)) {
if (oakFullpath && !option.stale &&
!features.runningTree.checkIsModiNode(oakFullpath) &&
!features.runningTree.isListDescandent(oakFullpath)) {
await this.refresh();
}
else {
@ -706,7 +708,9 @@ function createComponent(option, features) {
lifetimes?.show && lifetimes.show.call(this);
}
const { oakFullpath } = this.state;
if (oakFullpath && !features.runningTree.checkIsModiNode(oakFullpath) && !features.runningTree.isListDescandent(oakFullpath)) {
if (oakFullpath && !option.stale &&
!features.runningTree.checkIsModiNode(oakFullpath) &&
!features.runningTree.isListDescandent(oakFullpath)) {
this.refresh();
}
else {

1
lib/types/Page.d.ts vendored
View File

@ -41,6 +41,7 @@ interface ComponentOption<IsList extends boolean, ED extends EntityDict & BaseEn
*
*/
isList?: IsList;
stale?: boolean;
zombie?: true;
getTotal?: {
max: number;

View File

@ -704,7 +704,7 @@ const oakBehavior = Behavior<
const { oakFullpath } = this.state;
if (
oakFullpath &&
oakFullpath && !this.oakOption.stale &&
!this.features.runningTree.checkIsModiNode(
oakFullpath
) &&
@ -1115,7 +1115,9 @@ export function createComponent<
return;
}
const { oakFullpath } = this.state;
if (oakFullpath && !features.runningTree.checkIsModiNode(oakFullpath) && !features.runningTree.isListDescandent(oakFullpath)) {
if (oakFullpath && !option.stale &&
!features.runningTree.checkIsModiNode(oakFullpath) &&
!features.runningTree.isListDescandent(oakFullpath)) {
try {
await this.refresh();
}

View File

@ -974,7 +974,9 @@ export function createComponent<
try {
const { oakFullpath } = this.state;
if (oakFullpath && !features.runningTree.checkIsModiNode(oakFullpath) && !features.runningTree.isListDescandent(oakFullpath)) {
if (oakFullpath && !option.stale &&
!features.runningTree.checkIsModiNode(oakFullpath) &&
!features.runningTree.isListDescandent(oakFullpath)) {
await this.refresh();
}
else {
@ -1042,7 +1044,9 @@ export function createComponent<
lifetimes?.show && lifetimes.show.call(this);
}
const { oakFullpath } = this.state;
if (oakFullpath && !features.runningTree.checkIsModiNode(oakFullpath) && !features.runningTree.isListDescandent(oakFullpath)) {
if (oakFullpath && !option.stale &&
!features.runningTree.checkIsModiNode(oakFullpath) &&
!features.runningTree.isListDescandent(oakFullpath)) {
this.refresh();
}
else {

View File

@ -141,6 +141,7 @@ interface ComponentOption<
*
*/
isList?: IsList;
stale?: boolean;
zombie?: true;
getTotal?: {
max: number;