Local storage variables not saving updated values in deployed version

Is there any magic I need to do in order to save an updated value in local storage? I see my values in editor updating, however when I deploy and look at the variable in local storage it never gets updated.

In editor (After my update action):

in local storage after deployment (always):

How do you even troubleshoot variable values after deployment? How can I get the value in the console for example?

You’ll need to write some logic to check if the variable needs to be updated or not, then if it passes the logic, you can do something like Reset Variable Value.

The problem is that it is never saved in local storage. I am assuming weweb handles the actual saving to local storage when the variable is updated. In my case, it never gets saved in local storage with the updated values.

I am also not sure how to check if the variable itself got updated, as I am not sure how to do that in the deployed version in the console. With normal JS, I can just type in the variable and see it, but I do not know how WW wraps all of the variables. Any pointers?

Hmmm if you run that node, it should reset the value to whatever your default value is, and like always, you can force a new value with the Change Variable Value node.

To view the value in the console, it’s wwLib.wwVariable.getValue('09a7c78a-7417-459d-b3a6-c000f5d4649c')

just substitute the uuid for your variable id

1 Like

Thank you this is super helpful!

So, the variable gets updated, but it is never updated in local storage…
Console:

Local storage:

I tried going to another page just in case it saves to local storage on change but no luck :frowning:

I figured out what was the problem - I was updating the variable directly in Javascript not through Weweb’s functions and likely this is why the local storage update was not happening. I end up creating a workflow to update the variable the standard way Weweb does “update variable” and called it through:

wwLib.executeWorkflow(‘WORKFLOWID’, {‘ATTRIBUTE’ :value})

Putting this here in case anyone runs into similar issue :slight_smile: