supermedium/superframe

[state] `bind-for` entity components don't update when non-key values change

Opened this issue · 3 comments

I'm not sure if this is related to #243, as I've been forced to use the interpolation method for updating values (e.g., text="value: {{username}};"), due to bind-item not working as expected.

The issue is that I can't seem to get the bound entity components to update if the key does not change in the object.

As am example, I'd like to be able to update username in the following object, while using clientId as the key, since it is unique.

initialState: {
  users: [
    {
      clientId: '2ttwejglkjetot2asg',
      username: 'Bob'
    }
  ]
}

I've come up with a hacky workaround by using a separate id which is assigned a value with Date.now() appended, but then I need to remove and replace the user in order to get any updates, which also disturbs the display order.

To clarify, I can update the value in state, but changes are not reflected in the bound components.

I've tried using state.users.__dirty = true; to no avail.

Any guidance would be awesome.

Thanks for all you do.

This is happening in version 6.8.0, but haven't checked against all other versions yet.

@dsinni For me this works by using bind-item with item as the for value and setting state.users.__dirty = true;.

A-Frame: 0.9.2
frame-state-component: 6.8.0

Here is a working fiddle: https://jsfiddle.net/marlon360/3Lzmc65u/

thanks i tried updating the readme