@@ -33,11 +33,12 @@ import {
33
33
import styled from "styled-components" ;
34
34
import { lastValueIfEqual } from "util/objectUtils" ;
35
35
import { getNextEntityName } from "util/stringUtils" ;
36
- import { JSONValue } from "util/jsonTypes" ;
36
+ import { JSONObject , JSONValue } from "util/jsonTypes" ;
37
37
import { ButtonEventHandlerControl } from "./eventHandlerControl" ;
38
38
import { ControlItemCompBuilder } from "comps/generators/controlCompBuilder" ;
39
39
import { ColorControl } from "./colorControl" ;
40
40
import { StringStateControl } from "./codeStateControl" ;
41
+ import { reduceInContext } from "../utils/reduceContext" ;
41
42
42
43
const OptionTypes = [
43
44
{
@@ -312,8 +313,16 @@ export function mapOptionsControl<T extends OptionsControlType>(
312
313
}
313
314
314
315
override reduce ( action : CompAction ) {
315
- const comp = super . reduce ( action ) ;
316
+ // TODO: temporary solution condition to fix context issue in dropdown option's events
317
+ if (
318
+ action . type === CompActionTypes . CUSTOM
319
+ && ( action . value as JSONObject ) . type === 'actionTriggered'
320
+ ) {
321
+ const comp = reduceInContext ( { inEventContext : true } , ( ) => super . reduce ( action ) ) ;
322
+ return comp ;
323
+ } else
316
324
if ( action . type === CompActionTypes . UPDATE_NODES_V2 ) {
325
+ const comp = super . reduce ( action )
317
326
if ( comp . children . data !== this . children . data ) {
318
327
const sourceArray = comp . children . data . getView ( ) ;
319
328
const dataExample = sourceArray ? sourceArray [ 0 ] : undefined ;
@@ -323,7 +332,7 @@ export function mapOptionsControl<T extends OptionsControlType>(
323
332
}
324
333
}
325
334
}
326
- return comp ;
335
+ return super . reduce ( action ) ;
327
336
}
328
337
329
338
updateContext ( dataExample : JSONValue ) {
0 commit comments