-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Global config, simplify threading, custom operations #96
Conversation
* `select_all` option added to all operations which support a `selector` * `cancel` option added to almost all operations, intended to be set in a `before-` event callback * substantial reorganization of `cable_ready.js` to match the order in the docs
Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.10.10 to 1.11.1. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](sparklemotion/nokogiri@v1.10.10...v1.11.1) Signed-off-by: dependabot[bot] <support@github.com>
Bump nokogiri from 1.10.10 to 1.11.1
…ready into hopsoft/custom-operations
I see that we're moving configuration to the main namespace, which seems like a very reasonable thing to do. I don't love that we're changing https://cableready.stimulusreflex.com/customization#custom-operations If you're really hung up on it, might I suggest an alias as a compromise? |
So, having spent time with this, it seems like a great refactor. I've got some procedural questions that I want to ask for completeness: What, if any changes will be required to work with existing applications? Are the breaking changes confined to the configuration object + defining custom operations, or are there more changes that will impact more developers? Aside from the configuration stuff, has the public API changed at all? For example, I noticed that you added chaining to Finally, how does thread-local help with the security concerns? I read through that project's README but since users aren't assigned to a specific thread (are they!?) it seems like this is a partial solution but you're still on a party line. Happy to learn otherwise! Anyhow, I just ran my CableReady test suite with this PR and after I did a search-and-replace for |
I'm being explicit and pedantic for clarity and to avoid future confusion. Note also that
The registering of custom operations.
No
True. I was thinking of scenarios like: cable_ready[...]
.dispatch_event(...).broadcast # should execute on the client first
.inner_html(...).broadcast But, given that
CR broadcast payloads will be discreet and isolated to the thread that's handling the web request, background job, or web socket message. ActionCable, Puma, and Sidekiq all use a thread pool for performing work. Once a thread starts working on behalf of a user, it generally remains dedicated to that user until the work is complete. Sophisticated use of fibers can muddy the waters a bit; however, we're much further ahead by isolating CR channels and operations to thread based singletons. |
Thanks for all of that. I still would prefer add_operation over add_operation_name since we are adding an operation and not an operation_name (so how is this clearer?) but it's not the hill I'm going to die on. 👻 The concern I have with pushing a major update is that I assume there will be growing pains with either bundler or yarn when we bump SR to require v5 of CR. If people have explicitly required v4.x.x in the Gemfile/package.json, will there be warnings or will it just do it anyhow? |
I think we could avoid a major version bump if we have a good handle on the folks currently using custom operations. We could work with these folks to ensure a seamless upgrade. |
@n-rodriguez and @jonsgreen (and me) so far as I know. |
It's only been a little while, but it seems like only Nicolas is using them seriously in production so far. Other than the docs, we haven't seen any blog posts or anything about it, so this probably isn't shocking. Nicolas, you're a trailblazer! 😀 |
😂 |
Alright, @hopsoft, so here's what's shaken out for me. We'll change I do think we should omit chaining from Given the lack of response, I think we can safely update our customization API without a major version bump as we're in conversation with everyone using it. If you get rid of those two |
It works perfectly fine! 👍 |
Channels
Channel
andChannels
Custom operations can be added like so (at any time of the application lifecycle):
See the full example of how to use custom operations.
Note that StimulusReflex users will need to wait for stimulusreflex/stimulus_reflex#421 before they can use custom operations via the
cable_ready
helper method in their reflexes.