hotwire-django / turbo-django

Unmaintained // An early stage integration of Hotwire Turbo with Django
https://discuss.hotwire.dev/t/django-backend-support-for-hotwire/1570/
Other
385 stars 20 forks source link

A few stream consumer refactors #23

Closed blopker closed 3 years ago

blopker commented 3 years ago

I noticed that when navigating to different pages with a stream open, we'd get multiple stream responses like the unsubscribe event wasn't working. This is an attempt to fix that.

blopker commented 3 years ago

Steps to reproduce the duplicate events issue in current main branch:

  1. Make the template modifications in this PR
  2. Navigate to the room detail view
  3. Ensure the stream element has registered itself with Django channels
  4. Navigate the index page with the home link
  5. Go back to the room details page via link
  6. Add a message
  7. Observe the websocket gets multiple evens from the server where there should only be 1
davish commented 3 years ago

@blopker is this still a draft? Seems pretty complete to me

blopker commented 3 years ago

Ah, no, just got distracted with the realworld app.

davish commented 3 years ago

Go ahead and merge when ready!