News for hackers. Stuff that matters.
Re:Learn Stimulus in Ruby on Rails by Building a Toggle) by ignurant on Monday June 26, 2023 @10:34PM (#36488271)
I usually conditionally include the visibility toggle class from the erb side, so the first time it renders as html it has the toggle correctly initiated. I can see situations where the visibility logic is hard or impossible from the Ruby side, but I haven’t had this issue yet.
Re:Learn Stimulus in Ruby on Rails by Building a Toggle) by hbroadbent on Monday June 26, 2023 @11:12PM (#36488456)
Unfortunately I haven't come up with a good solution either beyond hiding the element with CSS, and then showing it when the controller connects (which isn't ideal). I'd love any suggestions though for different techniques