更新了一两个小的bug

This commit is contained in:
Xu Chang 2025-09-29 11:46:31 +08:00
parent e0f8544c8a
commit b817fbd384
9 changed files with 22 additions and 14 deletions

View File

@ -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,

View File

@ -18,6 +18,7 @@ export declare class DebugStore<ED extends EntityDict & BaseEntityDict, Cxt exte
constructor(storageSchema: StorageSchema<ED>, contextBuilder: (store: DebugStore<ED, Cxt>) => Cxt, authDeduceRelationMap: AuthDeduceRelationMap<ED>, selectFreeEntities?: (keyof ED)[], updateFreeDict?: {
[A in keyof ED]?: string[];
});
checkRelationAsync<T extends keyof ED, Cxt extends AsyncContext<ED>>(entity: T, operation: Omit<ED[T]["Operation"] | ED[T]["Selection"], "id">, context: Cxt): Promise<void>;
exec(script: string, txnId?: string): Promise<void>;
aggregate<T extends keyof ED, OP extends SelectOption>(entity: T, aggregation: ED[T]["Aggregation"], context: Cxt, option: OP): Promise<AggregationResult<ED[T]["Schema"]>>;
begin(option?: TxnOption): Promise<string>;

View File

@ -18,10 +18,9 @@ export class DebugStore extends TreeStore {
this.executor = new TriggerExecutor(() => contextBuilder(this));
this.relationAuth = new RelationAuth(storageSchema, authDeduceRelationMap, selectFreeEntities, updateFreeDict);
}
/*
checkRelationAsync<T extends keyof ED, Cxt extends AsyncContext<ED>>(entity: T, operation: Omit<ED[T]["Operation"] | ED[T]["Selection"], "id">, context: Cxt): Promise<void> {
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');
}

View File

@ -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) {

View File

@ -18,6 +18,7 @@ export declare class DebugStore<ED extends EntityDict & BaseEntityDict, Cxt exte
constructor(storageSchema: StorageSchema<ED>, contextBuilder: (store: DebugStore<ED, Cxt>) => Cxt, authDeduceRelationMap: AuthDeduceRelationMap<ED>, selectFreeEntities?: (keyof ED)[], updateFreeDict?: {
[A in keyof ED]?: string[];
});
checkRelationAsync<T extends keyof ED, Cxt extends AsyncContext<ED>>(entity: T, operation: Omit<ED[T]["Operation"] | ED[T]["Selection"], "id">, context: Cxt): Promise<void>;
exec(script: string, txnId?: string): Promise<void>;
aggregate<T extends keyof ED, OP extends SelectOption>(entity: T, aggregation: ED[T]["Aggregation"], context: Cxt, option: OP): Promise<AggregationResult<ED[T]["Schema"]>>;
begin(option?: TxnOption): Promise<string>;

View File

@ -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<T extends keyof ED, Cxt extends AsyncContext<ED>>(entity: T, operation: Omit<ED[T]["Operation"] | ED[T]["Selection"], "id">, context: Cxt): Promise<void> {
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');
}

View File

@ -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 || {};

View File

@ -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,

View File

@ -41,10 +41,10 @@ export class DebugStore<ED extends EntityDict & BaseEntityDict, Cxt extends Asyn
this.executor = new TriggerExecutor(() => contextBuilder(this));
this.relationAuth = new RelationAuth(storageSchema, authDeduceRelationMap, selectFreeEntities, updateFreeDict);
}
/*
checkRelationAsync<T extends keyof ED, Cxt extends AsyncContext<ED>>(entity: T, operation: Omit<ED[T]["Operation"] | ED[T]["Selection"], "id">, context: Cxt): Promise<void> {
return this.relationAuth.checkRelationAsync(entity, operation, context);
} */
}
async exec(script: string, txnId?: string) {
throw new Error('debugStore dont support exec script directly');