diff --git a/es/components/relation/path/upsert/index.js b/es/components/relation/path/upsert/index.js index 753738f1..3c6eb769 100644 --- a/es/components/relation/path/upsert/index.js +++ b/es/components/relation/path/upsert/index.js @@ -156,7 +156,7 @@ export default OakComponent({ return false; }); const schema = this.features.cache.getSchema(); - const legalSourceEntity = !!schema[choice.entity].relation?.length || choice.entity === 'user'; + const legalSourceEntity = !!schema[choice.entity].relation?.length || !!choice.entity; this.setState({ pathChoice: pathChoice2, pathChosen: pathChosen2, diff --git a/es/debugStore/DebugStore.d.ts b/es/debugStore/DebugStore.d.ts index f169f4ad..7b3f3142 100644 --- a/es/debugStore/DebugStore.d.ts +++ b/es/debugStore/DebugStore.d.ts @@ -18,6 +18,7 @@ export declare class DebugStore, contextBuilder: (store: DebugStore) => Cxt, authDeduceRelationMap: AuthDeduceRelationMap, selectFreeEntities?: (keyof ED)[], updateFreeDict?: { [A in keyof ED]?: string[]; }); + checkRelationAsync>(entity: T, operation: Omit, context: Cxt): Promise; exec(script: string, txnId?: string): Promise; aggregate(entity: T, aggregation: ED[T]["Aggregation"], context: Cxt, option: OP): Promise>; begin(option?: TxnOption): Promise; diff --git a/es/debugStore/DebugStore.js b/es/debugStore/DebugStore.js index 473d94cd..3b38ae21 100644 --- a/es/debugStore/DebugStore.js +++ b/es/debugStore/DebugStore.js @@ -18,10 +18,9 @@ export class DebugStore extends TreeStore { this.executor = new TriggerExecutor(() => contextBuilder(this)); this.relationAuth = new RelationAuth(storageSchema, authDeduceRelationMap, selectFreeEntities, updateFreeDict); } - /* - checkRelationAsync>(entity: T, operation: Omit, context: Cxt): Promise { - return this.relationAuth.checkRelationAsync(entity, operation, context); - } */ + checkRelationAsync(entity, operation, context) { + return this.relationAuth.checkRelationAsync(entity, operation, context); + } async exec(script, txnId) { throw new Error('debugStore dont support exec script directly'); } diff --git a/es/page.mp.js b/es/page.mp.js index e1c9230c..3da269d4 100644 --- a/es/page.mp.js +++ b/es/page.mp.js @@ -684,6 +684,10 @@ export function createComponent(option, features) { hide() { const { hide } = this.oakOption.lifetimes || {}; hide && hide.call(this); + /** + * 不能unsubscribeAll,小程序的页面不会销毁,如果一个页面需要token才能取数据,这时候去了登录页再回来就得依靠feature上的subscribe来refresh + * by Xc 20250913 + */ // this.unsubscribeAll(); }, resize(resizeOption) { diff --git a/lib/debugStore/DebugStore.d.ts b/lib/debugStore/DebugStore.d.ts index f169f4ad..7b3f3142 100644 --- a/lib/debugStore/DebugStore.d.ts +++ b/lib/debugStore/DebugStore.d.ts @@ -18,6 +18,7 @@ export declare class DebugStore, contextBuilder: (store: DebugStore) => Cxt, authDeduceRelationMap: AuthDeduceRelationMap, selectFreeEntities?: (keyof ED)[], updateFreeDict?: { [A in keyof ED]?: string[]; }); + checkRelationAsync>(entity: T, operation: Omit, context: Cxt): Promise; exec(script: string, txnId?: string): Promise; aggregate(entity: T, aggregation: ED[T]["Aggregation"], context: Cxt, option: OP): Promise>; begin(option?: TxnOption): Promise; diff --git a/lib/debugStore/DebugStore.js b/lib/debugStore/DebugStore.js index 3eeaba2f..e2ac76a0 100644 --- a/lib/debugStore/DebugStore.js +++ b/lib/debugStore/DebugStore.js @@ -21,10 +21,9 @@ class DebugStore extends oak_memory_tree_store_1.TreeStore { this.executor = new TriggerExecutor_1.TriggerExecutor(() => contextBuilder(this)); this.relationAuth = new RelationAuth_1.RelationAuth(storageSchema, authDeduceRelationMap, selectFreeEntities, updateFreeDict); } - /* - checkRelationAsync>(entity: T, operation: Omit, context: Cxt): Promise { - return this.relationAuth.checkRelationAsync(entity, operation, context); - } */ + checkRelationAsync(entity, operation, context) { + return this.relationAuth.checkRelationAsync(entity, operation, context); + } async exec(script, txnId) { throw new Error('debugStore dont support exec script directly'); } diff --git a/lib/page.mp.js b/lib/page.mp.js index 94117a9e..de2adc3a 100644 --- a/lib/page.mp.js +++ b/lib/page.mp.js @@ -682,12 +682,16 @@ function createComponent(option, features) { const { show } = this.oakOption.lifetimes || {}; show && show.call(this); this.reRender(); - this.subscribeAll(); + // this.subscribeAll(); }, hide() { const { hide } = this.oakOption.lifetimes || {}; hide && hide.call(this); - this.unsubscribeAll(); + /** + * 不能unsubscribeAll,小程序的页面不会销毁,如果一个页面需要token才能取数据,这时候去了登录页再回来就得依靠feature上的subscribe来refresh + * by Xc 20250913 + */ + // this.unsubscribeAll(); }, resize(resizeOption) { const { resize } = this.oakOption.lifetimes || {}; diff --git a/src/components/relation/path/upsert/index.ts b/src/components/relation/path/upsert/index.ts index 9c587ed5..48c60bdc 100644 --- a/src/components/relation/path/upsert/index.ts +++ b/src/components/relation/path/upsert/index.ts @@ -185,7 +185,7 @@ export default OakComponent({ } ); const schema = this.features.cache.getSchema(); - const legalSourceEntity = !!schema[choice.entity as keyof typeof schema].relation?.length || choice.entity; + const legalSourceEntity = !!schema[choice.entity as keyof typeof schema].relation?.length || !!choice.entity; this.setState({ pathChoice: pathChoice2, pathChosen: pathChosen2, diff --git a/src/debugStore/DebugStore.ts b/src/debugStore/DebugStore.ts index 736cfca7..b93dd7f1 100644 --- a/src/debugStore/DebugStore.ts +++ b/src/debugStore/DebugStore.ts @@ -41,10 +41,10 @@ export class DebugStore contextBuilder(this)); this.relationAuth = new RelationAuth(storageSchema, authDeduceRelationMap, selectFreeEntities, updateFreeDict); } -/* + checkRelationAsync>(entity: T, operation: Omit, context: Cxt): Promise { return this.relationAuth.checkRelationAsync(entity, operation, context); - } */ + } async exec(script: string, txnId?: string) { throw new Error('debugStore dont support exec script directly');