From b921e0936941a4354a9e755aab8c9accacb7078c Mon Sep 17 00:00:00 2001 From: "Xc@centOs" Date: Sat, 11 Nov 2023 20:43:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E5=89=8D=E7=AB=AFtr?= =?UTF-8?q?iggerExecutor=E7=9A=84=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- es/cacheStore/SyncTriggerExecutor.js | 2 +- es/debugStore/DebugStore.js | 4 ++-- es/features/cache.js | 2 +- lib/cacheStore/SyncTriggerExecutor.js | 2 +- lib/debugStore/DebugStore.js | 4 ++-- lib/features/cache.js | 2 +- src/cacheStore/SyncTriggerExecutor.ts | 4 ++-- src/debugStore/DebugStore.ts | 4 ++-- src/features/cache.ts | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/es/cacheStore/SyncTriggerExecutor.js b/es/cacheStore/SyncTriggerExecutor.js index bb491699..ff0c942b 100644 --- a/es/cacheStore/SyncTriggerExecutor.js +++ b/es/cacheStore/SyncTriggerExecutor.js @@ -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(trigger: Trigger) { diff --git a/es/debugStore/DebugStore.js b/es/debugStore/DebugStore.js index 3d1344bb..d0e82c61 100644 --- a/es/debugStore/DebugStore.js +++ b/es/debugStore/DebugStore.js @@ -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; diff --git a/es/features/cache.js b/es/features/cache.js index 9fde2828..0ebc58dc 100644 --- a/es/features/cache.js +++ b/es/features/cache.js @@ -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)); diff --git a/lib/cacheStore/SyncTriggerExecutor.js b/lib/cacheStore/SyncTriggerExecutor.js index 709124f2..0795930e 100644 --- a/lib/cacheStore/SyncTriggerExecutor.js +++ b/lib/cacheStore/SyncTriggerExecutor.js @@ -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(trigger: Trigger) { diff --git a/lib/debugStore/DebugStore.js b/lib/debugStore/DebugStore.js index 81a4ebc5..e6b9fd65 100644 --- a/lib/debugStore/DebugStore.js +++ b/lib/debugStore/DebugStore.js @@ -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; diff --git a/lib/features/cache.js b/lib/features/cache.js index 032d70aa..cb74e13b 100644 --- a/lib/features/cache.js +++ b/lib/features/cache.js @@ -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)); diff --git a/src/cacheStore/SyncTriggerExecutor.ts b/src/cacheStore/SyncTriggerExecutor.ts index e38b706f..eee01205 100644 --- a/src/cacheStore/SyncTriggerExecutor.ts +++ b/src/cacheStore/SyncTriggerExecutor.ts @@ -30,7 +30,7 @@ export default class SyncTriggerExecutor(entity: T, operation: ED[T]['Operation'], context: AsyncContext, 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; diff --git a/src/features/cache.ts b/src/features/cache.ts index 6e691f67..c538c598 100644 --- a/src/features/cache.ts +++ b/src/features/cache.ts @@ -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;