OpenHausIO / frontend

User interface for controlling things
2 stars 1 forks source link

Endpoints states are not reactive #115

Closed mStirner closed 10 months ago

mStirner commented 10 months ago

When a endpoint state is updated via HTTP API, its not reactive rendered. The frontend needs to be refreshed. Perhaps because of computed.states: https://github.com/OpenHausIO/frontend/blob/7e4bd6d8f794be1f61bc838efc91dd16432f337b/src/views/Endpoint.vue#L81-L92 ?

mStirner commented 10 months ago

A quick and dirty test:

  mounted() {
    let $route = useRoute();

    this.data = Array.from(store.endpoints).find((item) => {
      return item._id === $route.params._id;
    });

    console.log("Endpoint mounted", this.data.name);

    setInterval(() => {
      let state = this.data.states[0];
      state.value = Date.now();
      console.log(`Set state ${state.name}=${state.value}`);
    }, 1000);

  }

Computed properties states & commands are just for the header bar which represents number of commads/headers, and not the arrays of data/item.

Manipulating the value property does update the UI/rendering.

mStirner commented 10 months ago

The backend does not trigger any event which could lead to re-render. So, not really a frontend issue.

Keep this open till resolved/solution found.

mStirner commented 10 months ago

Fixed: https://github.com/OpenHausIO/backend/issues/401