flexiodata/flexio-sdk-js

Object references need to be killed to avoid outside mutation

dzwillia opened this issue · 3 comments

In the following code the object that is passed to the Javascript SDK via something like this Flexio.pipe(my_task_obj).toCode() is being copied instead of deep cloned. This keeps the object reference open, which causes any mutation to that object in the Javascript SDK (such as delete params['op']) to propagate back to code which called the Javascript SDK.

flexio-sdk-js/src/pipe.js

Lines 221 to 223 in 475e3dd

} else if (pipeconstruct_param.hasOwnProperty('op')) {
pipeobj.pipe.task = pipeconstruct_param
}

Thanks for pointing this out. I will fix it.

Thanks. This is the biggest issue I need fixed. Right now anytime I call Flexio.pipe(...).toCode() in the webapp code, I am doing the clone deep myself. It's in about 15 places in my code, so it'll be nice to have that fixed.

I thought about doing it myself, but I figured I'd go this route instead.

Fixed