Smashing / smashing

The exceptionally handsome dashboard framework in Ruby and Coffeescript.
https://smashing.github.io/
MIT License
3.22k stars 324 forks source link

Create EventSource at the right moment #182

Closed toy closed 3 years ago

toy commented 3 years ago

Closes #180

On small dashboard setTimeout with timeout 0 was enough to create EventSource after all widgets were initialised, but on big dashboards the ready event of layout (View instance for document) is the only event that is happening after all widgets get initialised and registered in the list.

kinow commented 3 years ago

Confirmed it fixes #180 , not sure about #181 (URL length), so leaving that one open for now. Preparing a release with this PR, thanks again @toy!

kinow commented 3 years ago

Added changelog, pushed to master with the commit merged :+1:

toy commented 3 years ago

@toy have you tested with 160 widgets and with long names too? I think for #181 the length of the generated URL wouldn't be fixed with only this change.

Locally (in docker image), so using thin, it works with 200 widgets each having id of 44 characters (longest in the issue was 42) resulting in a query string of 9401. Which confirms that all depends on the server and proxies on the way. But if one of them doesn't handle url or query string that long, the error should be very explicit with status 414 and no widget getting any data. Apparently it is not possible to get the status on error event for EventSource, so no way to automatically switch to not sending ids.