After speaking with one of our engineers about this, I found out the following:
Launch is designed to always retrieve a data element's value from its source every time the data element is used. If the value it retrieves is null or undefined, only then will it fall back to the "stored" value.
I believe this explains the behavior your seeing. I'm still working to see if there is a way to disable the fall back behavior or another work around that might help you accomplish what you are seeking.
Thanks for replying Jantzen. Unfortunately our test servers are in an internal environment.
I am not sure why the code doesn't work. To test it, I called _satellite.setVar('DE abc') first in a page where digitalData.abc has a value. I then navigated to a page where digitalData.abc is not populated and called _satellite.setVar('DE abc'). The return result was still the value of digitalData.abc. I then navigated to another page where digitalData.abc has a different value (say value B), called _satellite.setVar('DE abc'), then called _satellite.getVar('DE abc') and received Value B.
'DE abc' is configured via the code above.
What is the recommended practice when it comes to data elements in SPA? Am thinking of explicitly clearing all DEs in our page load rule, but that introduces a point of failure because all future DEs will have to be explicitly cleared. Another concern is the potential extra CPU time as opposed to just assigning variables directly to the data layer via code. That's unfortunate because we really want to use Launch's set variables UI to keep things clean and non-coder friendly.