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

Handle empty streamable array #528

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

coorasse
Copy link

This PR originates from a difficult debugging session I had.

In my model I had a typo:

after_create_commit -> { broadcast_append_to @chatroom }

and used @chatroom instead of chatroom. This error lead to an empty streamables array ([nil]) and the broadcasting was not working.

The error symptoms were:

  • the message does not appear on screen
  • I look at browsers network log and I don't see any message arriving in the websocket
  • I look at the logs and I spot the following:
[ActionCable] Broadcasting to : "<turbo-stream action=\"append\" ...

where you can see that the final stream name ends up being simply :. I had therefore an hard time to spot the issue.

This PR is very aggressive, and simply raises in such a context, maybe we would like a lighter (error message) approach? I think that if we have an empty streamables array is most probably an error.

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

Successfully merging this pull request may close these issues.

None yet

1 participant