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

turbo_stream.remove_all Not generating proper selector for targets. #637

Closed
t2 opened this issue Jun 19, 2024 · 0 comments
Closed

turbo_stream.remove_all Not generating proper selector for targets. #637

t2 opened this issue Jun 19, 2024 · 0 comments

Comments

@t2
Copy link

t2 commented Jun 19, 2024

When deleting an entity using Turbo, the remove_all stream action is not properly returning the selector in the stream. Please see below.

Gem: turbo-rails (2.0.5)
JS: @hotwired/turbo-rails@^8.0.4
@routine = Routine.find(params[:id])

respond_to do |format|
  format.turbo_stream do
    render turbo_stream: turbo_stream.remove_all(@routine)
  end

  format.html { redirect_to routines_path }
end
<turbo-stream action="remove" targets="#&lt;Routine:0x000000016b796988&gt;"></turbo-stream>
// Console output
DOMException: Failed to execute 'querySelectorAll' on 'Document': '#<Routine:0x0000000144d6f958>' is not a valid selector.
    at get targetElementsByQuery (http://localhost:3000/assets/application-esb-00291cc91fc91ec2365e55e77ee50f5725fda7f684dabce1c9176942cf33bde7.js:58784:45)
    at get targetElements (http://localhost:3000/assets/application-esb-00291cc91fc91ec2365e55e77ee50f5725fda7f684dabce1c9176942cf33bde7.js:58732:21)
    at HTMLElement.remove (http://localhost:3000/assets/application-esb-00291cc91fc91ec2365e55e77ee50f5725fda7f684dabce1c9176942cf33bde7.js:58667:12)
    at Object.renderElement [as render] (http://localhost:3000/assets/application-esb-00291cc91fc91ec2365e55e77ee50f5725fda7f684dabce1c9176942cf33bde7.js:58684:24)
    at http://localhost:3000/assets/application-esb-00291cc91fc91ec2365e55e77ee50f5725fda7f684dabce1c9176942cf33bde7.js:58700:31
    at async HTMLElement.connectedCallback (http://localhost:3000/assets/application-esb-00291cc91fc91ec2365e55e77ee50f5725fda7f684dabce1c9176942cf33bde7.js:58688:9)
@t2 t2 changed the title turbo_stream.remove_all Not generating proper key. turbo_stream.remove_all Not generating proper key for targets. Jun 19, 2024
@t2 t2 changed the title turbo_stream.remove_all Not generating proper key for targets. turbo_stream.remove_all Not generating proper selector for targets. Jun 19, 2024
@t2 t2 closed this as completed Jun 19, 2024
@t2 t2 reopened this Jun 19, 2024
@t2 t2 closed this as completed Jun 20, 2024
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

1 participant