This JS function takes 30 seconds to run eventhough it's a simple list.push()

I have a firestore response object (line 16-22). All I’m doing is making a var object, and appending it to the list in JSONGroupObject.
This function takes 30+ seconds to run (I know because I set the output as a page var, and the page var is then displayed in my app). It produces the output I want. It’s just super slow for such a simple function.

Any reason why and how I can optimize this?



I think there’s a couple of options for you to try. You’re returning JSONGrouoObject even though the correct reference is inputs.JSONGroupObject . If that doesn’t help, a slight nodered annoyance may be at play here. Binding the JSONGroupObject directly (i.e. using the page variable binding and referring to it as inputs.___ within the script) and then modifying that direct reference might mess up the reference itself and cause all kinds of side effects. You can try to fix it by binding the the JSONGroupObject to the inputs as a formula, and declaring it as its own variable in the beginning of the script:

const { JSONGroupObject, goalUID, groupUID } = inputs;

and then modify JSONGroupObject (instead of inputs.JSONGroupObject)