Renderitems not refreshing on mobile

Hi,

Do you have a clue on how this code doesn’t work for my items on mobile?


    window.fsAttributes = window.fsAttributes || [];
    window.fsAttributes.push([
      'cmsload',
      (listInstances) => {
        console.log('cmsload Successfully loaded!');

        const [listInstance] = listInstances;

        //Code to run once after the Attribute loads goes here

        listInstance.on('renderitems', (renderedItems) => {
          console.log(renderedItems);
          //Code to run each time items are rendered goes here
        });
      },
    ]);

Here’s the live page: Studio Format – Projets

Hey @pablo.faust! You are only targeting the first instance of the Attribute by using const [listInstance] = listInstances

For more than one instance of the Attribute you need to use this

<script>
  window.fsAttributes = window.fsAttributes || [];
  window.fsAttributes.push([
    'cmsload',
    (listInstances) => {
      console.log('cmsload Successfully loaded!');
      listInstances.forEach((instance) => {
        instance.on('renderitems', (renderedItems) => {
          // your code for all cmsload instances
        });
      });
    },
  ]);
</script>
1 Like

Awesome, thanks!!

1 Like