You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The variables option passed to sendVariableValues.transform is the exact object used in query execution (direct or gateway), so if you mutate it instead of just returning a copied object, you will surprisingly affect query execution. The docs even encourage you to do this:
The function should modify or delete necessary values in the variables map and return the result.
At the very least we should change the docs to tell you to not mutate the argument!
Doing some sort of clone (JSON.parse(JSON.stringify())?) on the variables that are passed in. This approach has a performance impact and could cause problems if somehow a variable's semantics aren't preserved through this clone process (though given that what happens to the thing returned by transform is that it gets JSON.stringify'd, maybe this isn't worth stressing about)
The text was updated successfully, but these errors were encountered:
The
variables
option passed tosendVariableValues.transform
is the exact object used in query execution (direct or gateway), so if you mutate it instead of just returning a copied object, you will surprisingly affect query execution. The docs even encourage you to do this:At the very least we should change the docs to tell you to not mutate the argument!
We may also want to do one or both of:
JSON.parse(JSON.stringify())
?) on the variables that are passed in. This approach has a performance impact and could cause problems if somehow a variable's semantics aren't preserved through this clone process (though given that what happens to the thing returned bytransform
is that it gets JSON.stringify'd, maybe this isn't worth stressing about)The text was updated successfully, but these errors were encountered: