Hi y'all,
I have some custom js that calls pushEvent on a window (scroll) event. This triggers a LiveView handler that updates an important view, but _only in some cases_. My problem is I would like to give the user some information about this request while it' in process, but I don't see a way to detect when it is finished in the case where no update occurs, because no component hook exists seems to exist for calls that don't result in any changes. It looks like internally, the live view js listens for the reply, but it doesn't give the caller access. Would it be possible to change that, so pushEvent returns a promise rather than undefined?
For now I think I can send a "dummy update" for these kinds of requests (essentially a random string) but I would love any tips about how to better solve this, or if I should open a PR. Thanks!
We are working on a mechanism that allows messages to be sent to a component - bypassing the current data-attribute/random string. So use the random string for now and we will have more news on this front soon. :)
Thank you!
In master!
Most helpful comment
We are working on a mechanism that allows messages to be sent to a component - bypassing the current data-attribute/random string. So use the random string for now and we will have more news on this front soon. :)