String contains an invalid character when filtering items from ais-RefinementList

Viewed 19

I want to filter out a particular item from an ais-refinement-list but with the below code I get the error: "String contains an invalid character."

The filtering works, the item I want to be removed is gone, but nothing after the refinement list renders.

What am I doing wrong?

<ais-refinement-list
    attribute="products"
    :transform-items="transformItems"
>
</ais-refinement-list>

export default {
    components: {
        AisRefinementList,
    },

    methods: {
        transformItems(items) {
            let filtered = items.filter(item => item.label !== 'XXXXX');
            return filtered.map(item => ({
                ...item,
                label: item.label,
            }));
            // return.filtered – produces the same error
        },
    }
};
1 Answers

It turns out I had a comma in my <ais-refinement-list> which I'd removed from the code I posted.

Related