Skip to content
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

introduce operations option for SR initialize #614

Closed
wants to merge 2 commits into from

Conversation

leastbad
Copy link
Contributor

@leastbad leastbad commented Dec 3, 2022

Type of PR (feature, enhancement, bug fix, etc.)

Bug fix + enhancement

Description

Introduces a new option to StimulusReflex.initialize, operations, which is used to override framework default CableReady operations for morph and replace tasks. The operations will default to morph and inner_html unless specified. Note that the default morph task is likely to become morphdom before SR 3.5 ships.

StimulusReflex.initialize(application, {
  controller,
  isolate: true,
  operations: {morph: 'idiomorph'}
})

Why should this be added

This should have been done with #599, which is currently broken. If the default operations are changed via the SR initializer, the Reflex is successfully created and executed on the server, but the event listeners were hard-coded to operate on morph and innerHtml operations. No client-side updates are possible in this scenario.

I will go back to update the README on the previous PR to reflect the need to pass an operations object when this PR is merged.

Checklist

  • My code follows the style guidelines of this project
  • Checks (StandardRB & Prettier-Standard) are passing
  • This is not a documentation update

@leastbad leastbad added bug Something isn't working javascript Pull requests that update Javascript code labels Dec 3, 2022
@leastbad leastbad added this to the 3.5 milestone Dec 3, 2022
@leastbad leastbad requested a review from marcoroth December 3, 2022 16:18
@leastbad leastbad self-assigned this Dec 3, 2022
@marcoroth
Copy link
Member

Looking at #599, we came to the conclusion that this is not needed anymore. If people want to use a morph library other than morphdom then they can configure it on the server-side via the morph_operation option:

StimulusReflex.configure do |config|
  config.morph_operation = :idiomorph
end

I'm going to close this one for now.

@marcoroth marcoroth closed this Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants