Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In tests, resetting a stream after adding items doesn't remove items #2816

Closed
nathanalderson opened this issue Sep 22, 2023 · 2 comments · Fixed by #2906
Closed

In tests, resetting a stream after adding items doesn't remove items #2816

nathanalderson opened this issue Sep 22, 2023 · 2 comments · Fixed by #2906

Comments

@nathanalderson
Copy link

Environment

  • Elixir version (elixir -v): 1.14.1 (OTP 25)
  • Phoenix version (mix deps): 1.6.15
  • Phoenix LiveView version (mix deps): 0.20.0
  • Operating system: Linux
  • Browsers you attempted to reproduce this bug on (the more the merrier): n/a
  • Does the problem persist after removing "assets/node_modules" and trying again? Yes/no: n/a

Actual behavior

In a LiveViewTest, sending items to the stream (via, for example, stream(socket, :some-stream, [item1, item2])) and subsequently resetting the stream (via stream(socket, :some-stream, [], reset: true)) does not remove the items from the DOM.

I have reproduced this in the testbench. See this comparison.

Expected behavior

Resetting a stream should always remove the items from the DOM.

@danschultzer
Copy link
Contributor

FWIW I opened this a while ago: #2677

I don't think this is the right way to solve it, but I couldn't grok the code path to map the phx stream. This was just the simplest fix I could think of.

nathanalderson added a commit to nathanalderson/phoenix_live_view that referenced this issue Oct 17, 2023
@nathanalderson
Copy link
Author

I updated my fork to test whether the recently merged #2864 would resolve this issue. It does not. The testcase I added to demonstrate the bug still fails in the same way. Updated branch is here, for reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants