Trying to implement an infinite scroll using phoenix liveview and alpine js intersect.
Concept is, when the last element comes into the viewport, it triggers a button click. That button has a phx-click attribute. The backend obviously adds items at that point. Not sure it’s the best way to do it, but it works wonderfully most of the time.
Thing is, when the last item already is in the viewport on load, that button click seems to happen too fast. The alpine js intersect event gets triggered, but the click doesn’t reach the backend.