Presence_state and presence_diff events, too close?

At the inital state of the app, when presence_state is triggered, the dispatch() callback funciton is called.
The presence_diff event has exactly the same callback function :

channel presence_state event has been triggered
about to call dispatch from presence_state event handler
dispatch function has been called
about to call update from dispatch
update function has been called
about to call view from dispatch
view function has been called
channel presence_diff event has been triggered
dispatch function has been called
about to call update from dispatch
update function has been called
about to call view from dispatch
view function has been called
about to patch the rootNode from dispatch
about to call command from dispatch
command function has been called
default command
TypeError: model is not iterable

[WDS] Hot Module Replacement enabled.

It looks like the presence_diff event didn’t let the time of the callback of presence_state to complete its job (no patch, no call of the command function).

Yes, this is ELM architecture in vanilla js ~

However, even with the TypeError: model is not iterable, the app is working fine, the presence state too, and the error doesn’t reappear after a new event (a key up from the view) or a new command (channel broadcast from the server).

Any advice?


Ok, the bug was in my update function inside a branch of the switch statement, nothing related to Presence.
Here is one of the (many) advantages to use ELM over JS.

1 Like