()
| 930 | } |
| 931 | |
| 932 | const __execute = async (): Promise<CallbackResult> => { |
| 933 | const loadingOutputs = flatten(outputs).map(out => ({ |
| 934 | path: getPath(paths, out.id), |
| 935 | property: out.property?.split('@')[0], |
| 936 | id: stringifyId(out.id) |
| 937 | })); |
| 938 | dispatch(loading(loadingOutputs)); |
| 939 | try { |
| 940 | const changedPropIds = keys<string>(cb.changedPropIds); |
| 941 | const parsedChangedPropsIds = changedPropIds.map(propId => { |
| 942 | if (propId.startsWith('{')) { |
| 943 | return parsePMCId(propId)[0]; |
| 944 | } |
| 945 | return propId; |
| 946 | }); |
| 947 | const payload: ICallbackPayload = { |
| 948 | output, |
| 949 | outputs: isMultiOutputProp(output) ? outputs : outputs[0], |
| 950 | inputs: inVals, |
| 951 | changedPropIds, |
| 952 | parsedChangedPropsIds, |
| 953 | state: cb.callback.state.length |
| 954 | ? fillVals(paths, layout, cb, state, 'State') |
| 955 | : undefined |
| 956 | }; |
| 957 | |
| 958 | if (clientside_function) { |
| 959 | try { |
| 960 | let data = await handleClientside( |
| 961 | dispatch, |
| 962 | clientside_function, |
| 963 | config, |
| 964 | payload |
| 965 | ); |
| 966 | // Patch methodology: always run through parsePatchProps for each output |
| 967 | const currentLayout = getState().layout; |
| 968 | flatten(outputs).forEach((out: any) => { |
| 969 | const propName = cleanOutputProp(out.property); |
| 970 | const outputPath = getPath(paths, out.id); |
| 971 | const dataPath = [stringifyId(out.id), propName]; |
| 972 | const outputValue = path(dataPath, data); |
| 973 | if (outputValue === undefined) { |
| 974 | return; |
| 975 | } |
| 976 | const oldProps = |
| 977 | path( |
| 978 | outputPath.concat(['props']), |
| 979 | currentLayout |
| 980 | ) || {}; |
| 981 | const newProps = parsePatchProps( |
| 982 | {[propName]: outputValue}, |
| 983 | oldProps |
| 984 | ); |
| 985 | data = assocPath( |
| 986 | dataPath, |
| 987 | newProps[propName], |
| 988 | data |
| 989 | ); |
no test coverage detected
searching dependent graphs…