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

locals: {action: nil} now results in undefined local variable or method. #570

Open
rubys opened this issue Feb 9, 2024 · 2 comments
Open

Comments

@rubys
Copy link

rubys commented Feb 9, 2024

Upgrading a rails 7.1 project that uses broadcast_replace_to to turbo-rails 2/turbo 8, resulted in the following test failure:

ActionView::Template::Error: undefined local variable or method `action' for an instance of #<Class:0x000000011ef58ad8>
    app/views/scores/_last_update.html.erb:1

In my case, setting locals: {action: false} will achieve the desired result, so I have a workaround, but previously I could set a local variable to nil. I've yet to find any docs that indicate that this is an intentional change in behavior.

If it helps, doing a git bisect identified the following as the change that broke this:

And links to the code that this change broke:

While turbo 8 provides other means by which this could be implemented, my impression was that this should continue to work.

@jjongs08
Copy link

jjongs08 commented Feb 22, 2024

I am using broadcast_append_later_to, but I am experiencing the same issue.

It seems that the problem is caused by a change in the logic of the broadcast_rendering_with_defaults method.

Can someone explain why compact is used in this code?

@shanereddy
Copy link

I am experiencing the same issue after upgrading to 2.0.5.

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

No branches or pull requests

3 participants