Filters working / not working randomly

Hi Finsweet fam,

I’m using Attributes v2 CMS filter for the first time. Everything seems set up correctly, sometimes the filters work perfectly, but other times they stop working when the page loads until I refresh. Could anyone let me know if I’ve missed something, or share suggestions for making sure the filter works consistently?

Sandbox Link

Hey @Farhan the filter script could be running before the CMS items are fully loaded

Try adding this just after the cdn

<script>
window.Webflow ||= \\\[\\\];
window.Webflow.push(() => {
   if (window.fsAttributes && window.fsAttributes.cmsfilter) {
      window.fsAttributes.cmsfilter.init(); // Attributes re-initialized after Webflow load
   }
});
</script>

hi @jesse.muiruri thanks for your reply :slight_smile: I’ve implemented the script and I still see the filters not working. Below are the examples:

When it works, it gives me facet count and I when I click on the categories it works

When it doesn’t It shows the static values I have set in webflow and I have to refresh the page to make it working again sometimes 2-3 times.

Sorry @Farhan

Earlier code had typos

Please try this one

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

    const [listInstance] = listInstances;
    console.log(listInstance);

  },
]);

The team is looking into this, will keep you posted

Thanks

1 Like

I have updated the code, will be testing this out today. Thanks @jesse.muiruri

Hi @jesse.muiruri updating here after a day of testing although I see it reduced by a lot i still see that it doesn’t work sometimes. I’m wondering what might be the issue. And do you know if this is normal and happens often?