Closed Malian closed 1 year ago
For those who wants to upgrade to 0.20, here's a workaround that works for me. In my case, I know that all the elements are present on the page, so deleting and adding each element "solves" the problem.
socket
|> then(fn socket ->
Enum.reduce(items, socket, fn item, socket ->
socket
|> stream_delete(:items, item)
|> stream_insert(:items, item)
end)
end)
However, this won't work on pages where I use pagination. Not sure how to quickly fix this without tracking the items on the page.
We stumbled across this as well trying to update to LV 0.20.1 from 0.19.5. We rely on reset: true
for rendering paginated, sortable tables. Staying on 0.19 for now.
Thanks!
I can confirm the commit fixes this issue. Thanks ! :heart:
I seem to be having an issue with reset: true
with infinite scroll where the page doesn't get reset when I change filter options for my query. Instead it seems to append the results to the next page.
I might be able to reproduce it later, but I was able to confirm that the problem exists on 0.20.1
and with {:phoenix_live_view, git: "https://github.com/phoenixframework/phoenix_live_view.git"},
(which I believe should be main
), but the problem goes away when I downgrade to 0.19.5
.
I was able to replicate this with normal pagination as well (offset/limit)
downgrading back to 0.19.5
also solved the issue for me thanks!
@ivank the version 0.20.2 should solve this issue.
@ivank the version 0.20.2 should solve this issue.
I've confirmed I still see the issue in 0.20.2
I'm having an issue with regular old offset pagination and filtering. It remembers the positions of the filtered elements and they stick around when filters are reset.
For example, consider this list:
If I filter on "Hello" the results are:
And when reseting the filters, which also does a stream reset, I get:
This does not happen on 0.19.x
.
@sodapopcan https://github.com/phoenixframework/phoenix_live_view/pull/2969 should fix this
Environment
Actual behavior
With the previous version of Phoenix Live View (0.19.5), when I reset a stream with
stream(socket, :my_stream, values, reset: true)
inhandle_params
orhandle_event
wherevalues
are the same as the previous stream but reordered, the stream was reinitialized. It is useful with a table when you order by a column (asc/desc).With the latest version of Phoenix Live View (0.20.0), the stream is not reset, and the table does not change.
Here is the code that reproduces the behaviour. Below, you will find the simple app that reproduces the bug.
Here is a working application (0.19.5): https://github.com/Malian/stream_reset_bug Here is the application upgraded to Phoenix Live View (0.20.0): https://github.com/Malian/stream_reset_bug/pull/1
Expected behavior
The stream has been reset.