Skip to content
Merged
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
3 changes: 2 additions & 1 deletion packages/brick-kit/src/core/StoryboardContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ export class StoryboardContextWrapper {
callback,
() =>
this.getResolveOptions(_internalApiGetCurrentContext())
.mergedContext
.mergedContext,
null
);

promise.then(
Expand Down
11 changes: 8 additions & 3 deletions packages/brick-kit/src/internal/bindListeners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,8 @@ function customListenerFactory(

export function eventCallbackFactory(
callback: BrickEventHandlerCallback,
getContext: () => PluginRuntimeContext
getContext: () => PluginRuntimeContext,
runtimeBrick: RuntimeBrick
) {
return function callbackFactory(
type: "success" | "error" | "finally" | "progress"
Expand All @@ -668,7 +669,7 @@ export function eventCallbackFactory(
});
const context = getContext();
[].concat(callback[type]).forEach((eachHandler) => {
listenerFactory(eachHandler, context, null)(event);
listenerFactory(eachHandler, context, runtimeBrick)(event);
});
} catch (err) {
// Do not throw errors in `callback.success` or `callback.progress`,
Expand Down Expand Up @@ -718,7 +719,11 @@ async function brickCallback(
return;
}

const callbackFactory = eventCallbackFactory(handler.callback, () => context);
const callbackFactory = eventCallbackFactory(
handler.callback,
() => context,
runtimeBrick
);

const pollableCallback: Required<PollableCallback> = {
progress: callbackFactory("progress"),
Expand Down