Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add original params to prompt callbacks #4862

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/packages/operators/src/built-in-operators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@
unlisted: true,
});
}
useHooks(ctx: ExecutionContext): {} {

Check warning on line 815 in app/packages/operators/src/built-in-operators.ts

View workflow job for this annotation

GitHub Actions / lint / eslint

'ctx' is defined but never used. Allowed unused args must match /^_/u
return { updatePanelState: useUpdatePanelStatePartial() };
}
async execute(ctx: ExecutionContext): Promise<void> {
Expand Down Expand Up @@ -1042,7 +1042,8 @@
operator: operator_uri,
params,
prompt: true,
callback: (result: OperatorResult) => {
callback: (result: OperatorResult, opts: { ctx: ExecutionContext }) => {
const ctx = opts.ctx;
if (result.error) {
triggerEvent(panelId, {
operator: on_error,
Expand All @@ -1051,7 +1052,7 @@
} else {
triggerEvent(panelId, {
operator: on_success,
params: { result: result.result },
params: { result: result.result, original_params: ctx.params },
});
}
},
Expand Down
2 changes: 1 addition & 1 deletion app/packages/operators/src/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -924,7 +924,7 @@ export function useOperatorExecutor(uri, handlers: any = {}) {
setResult(result.result);
setError(result.error);
setIsDelegated(result.delegated);
handlers.onSuccess?.(result);
handlers.onSuccess?.(result, { ctx });
callback?.(result);
} catch (e) {
callback?.(new OperatorResult(operator, null, ctx.executor, e, false));
Expand Down
Loading