Closed jonsgreen closed 3 years ago
Calling controller in a before_reflex keeps instance variables set in the reflex from being accessible in the view. Discord conversation here.
Here is an MVCE to demonstrate the behavior: https://github.com/jonsgreen/stimulus_reflex_input_bug/tree/lost-instance-variables-bug.
If you update the message comment you will see that the message is updated but the @comment set in the does not transfer to the view. If you comment out: https://github.com/jonsgreen/stimulus_reflex_input_bug/blob/lost-instance-variables-bug/app/reflexes/message_reflex.rb#L4 then it does.
@comment
Expect all instance variables set in a reflex to be available when rendering.
Hi Jonathan,
Describe the bug
Calling controller in a before_reflex keeps instance variables set in the reflex from being accessible in the view. Discord conversation here.
To Reproduce
Here is an MVCE to demonstrate the behavior: https://github.com/jonsgreen/stimulus_reflex_input_bug/tree/lost-instance-variables-bug.
If you update the message comment you will see that the message is updated but the
@comment
set in the does not transfer to the view. If you comment out: https://github.com/jonsgreen/stimulus_reflex_input_bug/blob/lost-instance-variables-bug/app/reflexes/message_reflex.rb#L4 then it does.Expected behavior
Expect all instance variables set in a reflex to be available when rendering.
Screenshots or reproduction
Versions
StimulusReflex
External tools