You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm also seeing this issue and with updating arrays in general. Attempting to update an existing array of: campaigns: ['camp-one', 'camp-two']
with an update of: campaigns: ['camp-one']
will still result in a datalayer with: campaigns: ['camp-one', 'camp-two']
when calling adobeDataLayer.getState()
Is this by design or a bug? I was expecting any update in general to be valid.
@jm-adobe in a case of wanting clear an array or pass new information on an event to the dataLayer. This also seems to be a possibility described in the documentation yet overwrite may not work as expected? .. One important detail to clarify is what happens when pushing data to an already existing array: it will overwrite the data of the inner array.
gabrielwalt
added
the
bug
Unexpected problem or unintended behavior that impairs normal functioning.
label
Jul 29, 2022
Let's start with this simple DataLayer object:
Then I push this:
Expected Behaviour
adobeDataLayer.getState() returning this:
Actual Behaviour
adobeDataLayer.getState() returning this:
Workaround
You need to push
null
to delete it before setting it to an empty array as described above.The other way would be to first find out how many items there are in the array already and do a push like this:
The text was updated successfully, but these errors were encountered: