-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Environment
- Elixir version (elixir -v): 1.17.0
- Phoenix version (mix deps):1.8.1
- Phoenix LiveView version (mix deps):1.1.17
- Operating system: Linux
- Browsers you attempted to reproduce this bug on (the more the merrier): Firefox
- Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: Yes
Actual behavior
I've managed to create a single file that demonstrates the issue: https://gist.github.com/derekkraan/bef48f9049049b308d4c8e27439e8c59
The behaviour is as follows: I have a LV stream, but on page load phx-viewport-top and phx-viewport-bottom are both unset (because there are not that many items in the stream to begin with). Then, when some new items appear (and the LV is notified of this via pubsub), we set phx-viewport-bottom, but it is never triggered.
I also noticed via debugging that the Phoenix.InfiniteScroll hook's mounted() callback wasn't being called in this instance.
The callbacks do work if they are added on page load. We are working around the issue at the present time with something like this: phx-viewport-bottom={if @bottom?, do: JS.push("no-op"), else: JS.push("next-page")}.
Expected behavior
I expect the phx-viewport-bottom and phx-viewport-top callbacks to trigger.