From js code
for (let i = 0; i < productData.length; i++) {
const data = dmxDataStructure(productData[i]);
dmx.parse(`content.products_info.add(${data})`);
}
From js code
for (let i = 0; i < productData.length; i++) {
const data = dmxDataStructure(productData[i]);
dmx.parse(`content.products_info.add(${data})`);
}
Ok i see something gets really wrong with the repeater on your page and i cannot replicate this locally using your data in an array. The repeat in my tests returns exactly the same amount of data as the array.
We will need to debug this more on your page to find what’s causing this. Can you keep the link live so we can use to debug?
sure, I’ll be live for 3 hours
Any updates ? I am closing the server now.
No, sorry - i will contact you tomorrow to open it again then, so we can test. Our Dutch office is closed today because of the Easter holidays so Patrick is not available, but will be tomorrow.
All right, thanks.
Any updates on this issue ?
Why not filter the array directly for the repeater. For the repeat use:
products_info.items.where(`response.product.id`, null, '!=')
That should filter out all items where response.product.id
is not set and you won’t need the conditional or show attribute.
Did you test it with only the conditional component or the show/hide attribute, do both give the same result?
I tried the filter method
But in response the repeat loaded all the items, including the extra elements.
And also tested with condition method. In this approach, the extra content is not visible, but the container is still displayed in the browser.
You can test the expression in the console with:
dmx.parse("products_info.items.where(`response.product.id`, null, '!=')");
and the one you used:
dmx.parse("products_info.items.where(`response`, undefined, '!=')")
I don’t know how exactly your data is structured, so I based my expression on the screenshot with the conditional region. I think both should return the same result when the response is missing on the item.
Seeing in an other screenshot items with $key=“shuffle” instead of a number, what is the exact input, it doesn’t seem to be an array but an object instead?
output following in the console:
dmx.parse("products_info.items")
Maybe you can open your ngrok link again so @patrick can inspect this live.
Seems that metro.js
is adding the methods clone
, contains
, shuffle
and unique
to the array prototype and that are the extra 4 items you see.
I will make a small adjustment to our code that should filter it out, will post an update here in a few minutes.
Here the update that should prevent the extra items being added.
dmxAppConnect.zip (26.1 KB)
Sorry, small leftover from a copy/paste.
dmxAppConnect.zip (26.1 KB)
It’s working great. Thanks