Conversation
hopsoft
left a comment
There was a problem hiding this comment.
This is a nice improvement. Love seeing those tests.
|
I'm still fuzzy on requires. Wouldn't it make sense to have it in the top-level file and remove it from broadcaster? |
|
I'd vote to have the requires top-level in Maybe it also makes sense to switch to Zeitwerk in the future. |
|
I have moved all of the Generally speaking, I don't really understand what would motivate I don't want to merge until someone either concurs or gently informs me that I was a little too aggressive. |
This PR proposes 4 related enhancements that brings some recent changes in StimulusReflex full circle.
dom_idfunction has been moved toCableReady::Identifiable, which we will include in StimulusReflex'sreflex.rbclass as a way to consolidate one implementation of the function. Also, users can include this module in their own projects.selectors can now acceptActiveRecord::BaseandActiveRecord::Relationobjects, the same way the new StimulusReflexmorphmethod accepts them eg. implicit dom_id for morph selectors stimulus_reflex#436selectoras a first parameter. This is a shortcut since so many operations accept aselector, and saves the developer from having to typeselector: "#users". If a selector is provided in theoptions, it overrides a specified selector.selectorfrom the previous operation, if any. This means that you can specify a selector at the beginning of a chain, and it will automatically be picked up by succeeding operations until a new selector is used, at which point that becomes the "new previous" operation for all following operations; if a new selector is used, all previously used selectors are unmodifed.