fix: incorrect app context

This commit is contained in:
gchust 2025-06-25 09:02:06 +08:00
parent fcaa643a37
commit 2db8bd92b0
5 changed files with 10 additions and 12 deletions

View File

@ -71,7 +71,7 @@ const MultiStepContextProvider: React.FC<MultiStepContextProviderProps> = ({
return {
model,
globals: model.flowEngine?.context || {},
app: model.flowEngine,
app: model.flowEngine?.context?.app,
step: null,
flow: null,
flowKey: '',
@ -85,7 +85,7 @@ const MultiStepContextProvider: React.FC<MultiStepContextProviderProps> = ({
return {
model,
globals: model.flowEngine?.context || {},
app: model.flowEngine,
app: model.flowEngine?.context?.app,
step,
flow,
flowKey,
@ -206,7 +206,7 @@ const openRequiredParamsStepFormDialog = async ({
const paramsContext = {
model,
globals: model.flowEngine?.context || {},
app: model.flowEngine,
app: model.flowEngine?.context?.app,
};
for (const { flowKey, stepKey, step } of requiredSteps) {
@ -454,4 +454,4 @@ const openRequiredParamsStepFormDialog = async ({
});
};
export { openRequiredParamsStepFormDialog, useStepSettingContext };
export { openRequiredParamsStepFormDialog };

View File

@ -91,7 +91,7 @@ const openStepSettingsDialog = async ({
const paramsContext = {
model,
globals: model.flowEngine?.context || {},
app: model.flowEngine,
app: model.flowEngine?.context?.app,
};
// 解析 defaultParams
@ -138,7 +138,7 @@ const openStepSettingsDialog = async ({
const contextValue: StepSettingContextType = {
model,
globals: model.flowEngine?.context || {},
app: model.flowEngine,
app: model.flowEngine?.context?.app,
step,
flow,
flowKey,

View File

@ -91,7 +91,7 @@ const openStepSettingsDrawer = async ({
const paramsContext = {
model,
globals: model.flowEngine?.context || {},
app: model.flowEngine,
app: model.flowEngine?.context?.app,
};
// 解析 defaultParams
@ -180,7 +180,7 @@ const openStepSettingsDrawer = async ({
const contextValue: StepSettingContextType = {
model,
globals: model.flowEngine?.context || {},
app: model.flowEngine,
app: model.flowEngine?.context?.app,
step,
flow,
flowKey,

View File

@ -142,7 +142,7 @@ const FlowSettingsContent: React.FC<FlowSettingsContentProps> = observer(({ mode
const paramsContext = {
model,
globals: model.flowEngine?.context || {},
app: model.flowEngine,
app: model.flowEngine?.context?.app,
};
// 从model中获取每个步骤的参数如果为空则使用默认参数

View File

@ -377,9 +377,7 @@ export class FlowModel<Structure extends { parent?: any; subModels?: any } = Def
async applyFlow(flowKey: string, extra?: FlowExtraContext): Promise<any> {
const currentFlowEngine = this.flowEngine;
if (!currentFlowEngine) {
console.warn(
'FlowEngine not available on this model for applyFlow. Check model.app and model.app.flowEngine setup.',
);
console.warn('FlowEngine not available on this model for applyFlow. Check and model.flowEngine setup.');
return Promise.reject(new Error('FlowEngine not available for applyFlow. Please set flowEngine on the model.'));
}