mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
Make state variables accessible in transformations
This commit is contained in:
parent
3c6669799e
commit
1a63cb392a
1 changed files with 4 additions and 2 deletions
|
|
@ -48,11 +48,13 @@ export function fetchOAuthToken(authUrl, dataSourceId) {
|
|||
|
||||
export function runTransformation(_ref, rawData, transformation) {
|
||||
const data = rawData;
|
||||
const evalFunction = Function(['data', 'moment', '_', 'currentState'], transformation);
|
||||
const evalFunction = Function(['data', 'moment', '_', 'components', 'queries', 'globals'], transformation);
|
||||
let result = [];
|
||||
|
||||
const currentState = _ref.state.currentState || {};
|
||||
|
||||
try {
|
||||
result = evalFunction(data, moment, _, _ref.state.currentState);
|
||||
result = evalFunction(data, moment, _, currentState.components, currentState.queries, currentState.globals);
|
||||
} catch (err) {
|
||||
toast.error(err.message, { hideProgressBar: true });
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue