Value Converter update problems with arrays

Hi,

I have a repeat.for loop on an array of object, and I filter this array with anotherArray in a custom value converter.
When the otherArray changes, my view is not refreshed. I tried to use signalBindings to explicitly trigger the refresh of the view but it does not seem to work that way.
Am I expecting things that are not supposed to work? Is there another way to do this?

Here the gist to reproduce my problem : https://gist.run/?id=31f739c99c7347853089226c9e2ff980

Thank you,
Cheers,

the problem is that your array is not changing, (items are being added to it - but the array reference doesn’t change).
I don’t know why the custom signal is not working.
and I’m pretty sure this code use to work (I’m not sure in what version of what package).
I’ve recently also had breaking changes in my app regarding changes in array that are not reflected properly, and I came up with a easy fix.
in your binding, add the length of the array as a parameter, that way - when the length changes - the binding will reevaluate.

<template>
  <div repeat.for="item of array | customArrayFilter:otherArray:otherArray.length">
    <span>${item.id} : ${item.value}</span>
  </div>
</template>
1 Like

It seems that the declaration of the signals inside the value-converter doesn’t work like I did it, or has not to be done like this anymore?
I fixed it using the signal binding behavior directly in my view like :

<template>
 <div repeat.for="item of array | customArrayFilter:otherArray & signal:'custom-signal-changed'">
  <span>${item.id} : ${item.value}</span>
  </div>
 </template>

In your example, you were not assigning value to signals, but declaring type for it

change to signals = ['custom-..']

Probably you were using typescript, and did the same thing ?