-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
Morph stimulus reflex element AKA "single element page morph" #522
Morph stimulus reflex element AKA "single element page morph" #522
Conversation
Failing tests are also because of the dependency on cableready/master |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a suggestion to memoize update.selector
if reasonable.
I did my best to trace the logic of your refactoring; it looks good but to offer you advice I frequently don't take myself: it's easier to click Approve if you keep refactoring and feature implementation in separate PRs. 😉
Re splitting: yes, but at the cost at producing merge conflicts 😜 |
All done! |
LGTM! |
42c5354
to
805d17b
Compare
lib/stimulus_reflex/broadcasters/selector_broadcaster/update.rb
Outdated
Show resolved
Hide resolved
bd1e7c9
to
9875d98
Compare
f15e51f
to
96b8c9d
Compare
Feature
Description
This PR allows to morph over the
StimulusReflex::Element
that initiated the reflex, like so:morph element, render(MyComponent.new(...))
This is especially handy when
this.stimulate
with a dedicated element as a targetWhy should this be added
Often, when performing a selector morph, one is altering the state of a single piece of the UI and patching it. This PR allows to do so without explicitly stating a selector or AR model/relation,
❗ Attention
depends on stimulusreflex/cable_ready#135
Checklist
Please note that the best way to suggest changes or updates to the documentation is to join Discord and leave a note in the #docs channel. Any documentation updates posted as PRs cannot be accepted at this time. ❤️