Data-bind-if behaves unexpectedly when combined with data-bind-for

Describe the bug: The gist of this bug is if you have a data-bind-for, as well as a data-bind-if, you get an incorrect output under certain conditions, after replacing the entire array that data-bind-for it’s iterating over.

If I may insert my own assumptions here, I think it’s due to the initial data model that’s setup. But I’m not sure why or how it’s being effected.

This originally popped up with a bug in Strife’s scoreboard, where players were appearing twice, despite being generated from GetWorld():ForEachUser.

How do you cause this bug?

I’ve created a reproduction here: Crayta

Pressing the interact button (E) will generate between 0 and 25 numbers. Using that single list of numbers, I use data-bind-for and data-bind-if to display the odd numbers in one list, and the even numbers in another list.

If you press the E button a number of times, you’ll start to notice that the lists occasionally don’t make sense. For example, you may see a 6 in the odd column, or perhaps it’s displaying a number out of sorted order.

To expand on why I think it has something to do with the initial data model, if you replace the 6 in the original data with a “B”, you’ll start to see a duplicate 7. That indicates that the initial data structure is having some sort of an effect on the re-rendered data.

Your Crayta username: Cereal

Game seen in (including “Hub” or “Editor for XYZ”): Strife

How regularly do you see this? (E.g. 2/3 times - please try 3 times if possible): This usually pops up when someone joins the game mid-round in strife. Makes me think there’s some sort of caching going on with widget data, and replacing entire arrays confuses it.

Time + date seen: February 27 2022

Version number (found in Help tab in Settings): 0.e5.40.115857

1 Like

Hey there @Cereal !

Happy 1 year Crayta Anniversary! :cake:

Thank you very much for the detailed information as well re-creating a game for us to check out.
I have gone ahead and opened up a ticket for our internal team to investigate this further ! :slight_smile:

1 Like

Hi @Cereal,

Thanks for reporting the issue. I’ve reproduced the problem on our end and I’m working with our middleware provider to get it resolved. The issue appears to occur when the data-bind-if is on the same elements as the data-bind-for, so for now I suggest nesting the data-bind-if onto a child element inside the data-bind-for, which should work as expected.