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
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,10 @@ function actionSelectorControl(needContext: boolean) {
const condition = this.children.condition.getView();
const ignored = getReduceContext().disableUpdateState || (isConditionSet && !condition);
const ignorePromise = Promise.resolve();
const realNeedContext = needContext || getReduceContext().inEventContext;
const actionPromise = () => {
// return realNeedContext ? action.value.func() : this.children.comp.getView()();
// commenting because it's using old context for event handlers inside list/grid
return this.children.comp.getView()();
return action.value.context && action.value.func
? action.value.func()
: this.children.comp.getView()();
};
handlePromiseAfterResult(action, ignored ? ignorePromise : actionPromise());
return this;
Expand Down
10 changes: 1 addition & 9 deletions client/packages/lowcoder/src/comps/controls/optionsControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import { JSONObject, JSONValue } from "util/jsonTypes";
import { ButtonEventHandlerControl } from "./eventHandlerControl";
import { ControlItemCompBuilder } from "comps/generators/controlCompBuilder";
import { ColorControl } from "./colorControl";
import { reduceInContext } from "../utils/reduceContext";

import { BorderOuterOutlined } from "@ant-design/icons";

// Tag preset color options
Expand Down Expand Up @@ -334,14 +334,6 @@ export function mapOptionsControl<T extends OptionsControlType>(
}

override reduce(action: CompAction) {
// TODO: temporary solution condition to fix context issue in dropdown option's events
if (
action.type === CompActionTypes.CUSTOM
&& (action.value as JSONObject).type === 'actionTriggered'
) {
const comp = reduceInContext({ inEventContext: true }, () => super.reduce(action));
return comp;
} else
if (action.type === CompActionTypes.UPDATE_NODES_V2) {
const comp = super.reduce(action)
if (comp.children.data !== this.children.data) {
Expand Down
Loading