修正了前端triggerExecutor的行为
This commit is contained in:
parent
1711b787d2
commit
b921e09369
|
|
@ -55,7 +55,7 @@ export default class SyncTriggerExecutor {
|
|||
action.forEach(a => this.addToCheckerMap(a, entity, priority || CHECKER_PRIORITY_MAP[type], when, fn, type, conditionalFilter));
|
||||
}
|
||||
else {
|
||||
this.addToCheckerMap(action, entity, priority, when, fn, type, conditionalFilter);
|
||||
this.addToCheckerMap(action, entity, priority || CHECKER_PRIORITY_MAP[type], when, fn, type, conditionalFilter);
|
||||
}
|
||||
}
|
||||
/* registerTrigger<T extends keyof ED>(trigger: Trigger<ED, T, Cxt>) {
|
||||
|
|
|
|||
|
|
@ -28,11 +28,11 @@ export class DebugStore extends TreeStore {
|
|||
}
|
||||
async cascadeUpdateAsync(entity, operation, context, option) {
|
||||
// 如果是在modi处理过程中,所有的trigger也可以延时到apply时再处理(这时候因为modi中的数据并不实际存在,处理会有问题)
|
||||
if (!option.blockTrigger && !option.modiParentEntity) {
|
||||
if (!option.blockTrigger) {
|
||||
await this.executor.preOperation(entity, operation, context, option);
|
||||
}
|
||||
const result = await super.cascadeUpdateAsync(entity, operation, context, option);
|
||||
if (!option.blockTrigger && !option.modiParentEntity) {
|
||||
if (!option.blockTrigger) {
|
||||
await this.executor.postOperation(entity, operation, context, option);
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export class Cache extends Feature {
|
|||
this.syncEventsCallbacks = [];
|
||||
this.cacheStore = new CacheStore(storageSchema);
|
||||
this.contextBuilder = () => frontendContextBuilder()(this.cacheStore);
|
||||
this.savedEntities = ['actionAuth', 'i18n', ...(savedEntities || [])];
|
||||
this.savedEntities = ['actionAuth', 'i18n', 'path', ...(savedEntities || [])];
|
||||
this.keepFreshPeriod = keepFreshPeriod || DEFAULT_KEEP_FRESH_PERIOD;
|
||||
this.localStorage = localStorage;
|
||||
checkers.forEach((checker) => this.cacheStore.registerChecker(checker));
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class SyncTriggerExecutor {
|
|||
action.forEach(a => this.addToCheckerMap(a, entity, priority || types_1.CHECKER_PRIORITY_MAP[type], when, fn, type, conditionalFilter));
|
||||
}
|
||||
else {
|
||||
this.addToCheckerMap(action, entity, priority, when, fn, type, conditionalFilter);
|
||||
this.addToCheckerMap(action, entity, priority || types_1.CHECKER_PRIORITY_MAP[type], when, fn, type, conditionalFilter);
|
||||
}
|
||||
}
|
||||
/* registerTrigger<T extends keyof ED>(trigger: Trigger<ED, T, Cxt>) {
|
||||
|
|
|
|||
|
|
@ -31,11 +31,11 @@ class DebugStore extends oak_memory_tree_store_1.TreeStore {
|
|||
}
|
||||
async cascadeUpdateAsync(entity, operation, context, option) {
|
||||
// 如果是在modi处理过程中,所有的trigger也可以延时到apply时再处理(这时候因为modi中的数据并不实际存在,处理会有问题)
|
||||
if (!option.blockTrigger && !option.modiParentEntity) {
|
||||
if (!option.blockTrigger) {
|
||||
await this.executor.preOperation(entity, operation, context, option);
|
||||
}
|
||||
const result = await super.cascadeUpdateAsync(entity, operation, context, option);
|
||||
if (!option.blockTrigger && !option.modiParentEntity) {
|
||||
if (!option.blockTrigger) {
|
||||
await this.executor.postOperation(entity, operation, context, option);
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class Cache extends Feature_1.Feature {
|
|||
this.syncEventsCallbacks = [];
|
||||
this.cacheStore = new CacheStore_1.CacheStore(storageSchema);
|
||||
this.contextBuilder = () => frontendContextBuilder()(this.cacheStore);
|
||||
this.savedEntities = ['actionAuth', 'i18n', ...(savedEntities || [])];
|
||||
this.savedEntities = ['actionAuth', 'i18n', 'path', ...(savedEntities || [])];
|
||||
this.keepFreshPeriod = keepFreshPeriod || DEFAULT_KEEP_FRESH_PERIOD;
|
||||
this.localStorage = localStorage;
|
||||
checkers.forEach((checker) => this.cacheStore.registerChecker(checker));
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ export default class SyncTriggerExecutor<ED extends EntityDict & BaseEntityDict,
|
|||
let iter = 0;
|
||||
const checkers = this.checkerMap[entity]![action]!;
|
||||
for (; iter < checkers.length; iter++) {
|
||||
if (priority! <= checkers[iter].priority!) {
|
||||
if (priority <= checkers[iter].priority!) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ export default class SyncTriggerExecutor<ED extends EntityDict & BaseEntityDict,
|
|||
);
|
||||
}
|
||||
else {
|
||||
this.addToCheckerMap(action as string, entity, priority!, when, fn as any, type, conditionalFilter);
|
||||
this.addToCheckerMap(action as string, entity, priority || CHECKER_PRIORITY_MAP[type], when, fn as any, type, conditionalFilter);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ export class DebugStore<ED extends EntityDict & BaseEntityDict, Cxt extends Asyn
|
|||
|
||||
protected async cascadeUpdateAsync<T extends keyof ED, OP extends DebugStoreOperateOption>(entity: T, operation: ED[T]['Operation'], context: AsyncContext<ED>, option: OP) {
|
||||
// 如果是在modi处理过程中,所有的trigger也可以延时到apply时再处理(这时候因为modi中的数据并不实际存在,处理会有问题)
|
||||
if (!option.blockTrigger && !option.modiParentEntity) {
|
||||
if (!option.blockTrigger) {
|
||||
await this.executor.preOperation(entity, operation, context as Cxt, option);
|
||||
}
|
||||
const result = await super.cascadeUpdateAsync(entity, operation, context, option);
|
||||
if (!option.blockTrigger && !option.modiParentEntity) {
|
||||
if (!option.blockTrigger) {
|
||||
await this.executor.postOperation(entity, operation, context as Cxt, option);
|
||||
}
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ export class Cache<
|
|||
|
||||
this.cacheStore = new CacheStore(storageSchema);
|
||||
this.contextBuilder = () => frontendContextBuilder()(this.cacheStore);
|
||||
this.savedEntities = ['actionAuth', 'i18n', ...(savedEntities || [])];
|
||||
this.savedEntities = ['actionAuth', 'i18n', 'path', ...(savedEntities || [])];
|
||||
this.keepFreshPeriod = keepFreshPeriod || DEFAULT_KEEP_FRESH_PERIOD;
|
||||
this.localStorage = localStorage;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue