App variable still being updated by another? Is there a way to disconnect them?[Solved]

I have two appVariables.

One which is the ‘fullRecordList’ which is retrieved from an API call on the home page.

It creates repeat tiles using the repeat function.

Then when someone clicks on the repeater tile of their choice, I send the repeat.current object to another separate appVariable called ‘currentlyChangingRecord’.

This is working great - however if someone updates ‘currentlyChangingRecord’ using the UI - it is ALSO UPDATING IN THE fullRecordList! Even though I assigned the repeat.current out to another variable.


Is there a way I can detatch this relationship so that the fullRecordList remains unedited? I want that to be controled by the API calls only.

Thank you

Ask and you shall find…the answer yourself…literally not 8 minutes later :smiley:

So setAppVariable with repeat.current was creating a live data relationship between the two.
I think this for the most part is intended.

I know that javascript’s MAP function creates a new object array so that the original is unchanged, but because I wasn’t modifying any values in my array I couldn’t get it to work.

In the end I simply did
DECODE_JSON(ENCODE_JSON(repeated.current))

LOL!

Bascially this is encoding the object into a string, and then de-coding it back into an object.
But in doing so - it breaks the connection between the appVariable and the globalVariable.

Hope this helps anyone who is looking for immutable variables.

Peace