OpenFn / kit

The bits & pieces that make OpenFn work. (diagrammer, cli, compiler, runtime, runtime manager, logger, etc.)
8 stars 12 forks source link

Fix lazy state #643

Closed josephjclark closed 3 months ago

josephjclark commented 3 months ago

The lazy state operator $ is causing trouble if you try to use $ as a variable, a la:

parseXML(state.data, $ => {
    const inner = $.load(response.text()); // error
 });

This PR adds a bit of intelligence to the is-this-a-lazy-state-reference heuristic to ignore $ variable declared in the source. See the unit tests for details.

josephjclark commented 3 months ago

@mtuchi assuming this passes CI tests and it works for you, you can merge it and it'll be released! You'll have to ask Taylor to bump the lightning worker

mtuchi commented 3 months ago

@josephjclark let's hold this, i would love to test before merging.

mtuchi commented 3 months ago

Hiya @josephjclark i have tested this, it works as expected. Thanks for the fix 👍🏽