New CR wire format + reworked server message events #536
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of PR (feature, enhancement, bug fix, etc.)
Enhancement
Designed to work with stimulusreflex/cable_ready#142 - you will need to check out both branches and use local bundles and yarn link (or whatever you do when you do this) to make everything connect up.
Description
One interesting aspect of this PR is that I had to add
before-dispatch-event
and specifically,after-dispatch-event
callbacks to CableReady'sdispatch_event
operation. This is all in service of removing the repetitiveevent.detail ? event.detail.stimulusReflex : event.stimulusReflex
logic that litered the library previously. That's because when we are working with CableReady operations, we extract data from the CableReady operation as well as the event itself. In fact, thestimulus-reflex:morph-nothing
(andmorph-halted
andmorph-error
) events are largely unused, except to obtain the type of the currently running Reflex.Why should this be added
If we adopt the new CR wire format, much of this would be necessary regardless.
That said, these changes allowed me to remove rough edges and ugly, confusing bits from several important mechanisms. I believe that the library is now significantly easier to refactor, test and add new features to.
Checklist