WebThingsIO / gateway

WebThings Gateway
http://webthings.io/gateway
Mozilla Public License 2.0
2.61k stars 335 forks source link

Things get rendered twice #3103

Open benfrancis opened 1 year ago

benfrancis commented 1 year ago

When debugging the gateway front end I have noticed when that when the Things screen is loaded, the collection of Things is actually rendered twice. Each Thing is rendered in turn, then the view is cleared, then they are rendered again.

I also note that the /things resource is fetched three times, and /groups twice. Something is causing a refresh during page load.

STR:

Expected:

Actual:

benfrancis commented 1 year ago

I also note that on the thing detail view, the Thing gets rendered twice.

benfrancis commented 1 year ago

Ah, I've narrowed this down to https://github.com/WebThingsIO/gateway/blob/master/static/js/models/gateway-model.js#L149

refreshThings() is called both when the /things WebSocket is opened, and when the /groups WebSocket is opened.