view_component_reflex 2.6.0 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48be01529611392c673d2ca154ba25657bde6564cfb9238c78debea251f3aa11
4
- data.tar.gz: 41d40953951fbd6d26fa4044ad41e1ca6b5b2a969439404d78f755853ea1acca
3
+ metadata.gz: 707610d40c14c49d025779455b65bc00e5a62f6ac5efb45b67465ddaf877e037
4
+ data.tar.gz: d968005df1c10fc89d6a596acccaa114a1c7fda23d159f1e49f7a065591c55ce
5
5
  SHA512:
6
- metadata.gz: a6b645acacb1f3716b05cf134225255096aa80ef47a131949d79f0cbfec69a9623c6f26d061d381f6637ff26501eeaeabdfe17c52e7cb2be027eda0e5eba91ec
7
- data.tar.gz: 9d714a2889b6d4f100cd816f6068699e86966807bf529353b9ab2699738d649a5169116926e75fd5690a2cbb7a0583574cf164b52518b4cff29e86745a38d803
6
+ metadata.gz: 6a852616da1e12e5cc0d54017b738ea97040092a1c9801a8355aca89681846dcc08b6e5e62ab6209d2c48b7328f46e4c42896a20f54cb465af896c05442dc94e
7
+ data.tar.gz: fd389d8e0706b8f7133d01953b31c06e8d08c88dfa3015bb5f443c57b6e34604bb81de16bea00e2861eb39aadd90d0c36a3a733e247af74b0fa9c7f33b9ee8b4
data/README.md CHANGED
@@ -6,7 +6,7 @@ It builds upon [stimulus_reflex](https://github.com/hopsoft/stimulus_reflex) and
6
6
 
7
7
  ## Usage
8
8
 
9
- You can add reflexes to your component by adding inheriting from `ViewComponentReflex::Component`.
9
+ You can add reflexes to your component by inheriting from `ViewComponentReflex::Component`.
10
10
 
11
11
  This will act as if you created a reflex with the method `my_cool_stuff`. To call this reflex, add `data-reflex="click->MyComponentReflex#my_cool_reflex"`, just like you're
12
12
  using stimulus reflex.
@@ -124,7 +124,7 @@ def initialize
124
124
  end
125
125
 
126
126
  def collection_key
127
- @my_model.id
127
+ @my_model.id
128
128
  end
129
129
  ```
130
130
 
@@ -348,6 +348,17 @@ $ gem install view_component_reflex
348
348
  ## Uninitialized constants \<component\>Reflex
349
349
  A component needs to be wrapped in `<%= component_controller do %>` in order to properly initialize, otherwise the Reflex class won't get created.
350
350
 
351
+ ## Session is an empty hash
352
+ StimulusReflex 3.3 introduced _selector morphs_, allowing you to render arbitrary strings via `ApplicationController.render`, for example:
353
+
354
+ ```rb
355
+ def test_selector
356
+ morph '#some-container', ApplicationController.render(MyComponent.new(some: :param))
357
+ end
358
+ ```
359
+
360
+ StimulusReflex 3.4 introduced a fix that merges the current `request.env` and provides the CSRF token to fetch the session.
361
+
351
362
  ## License
352
363
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
353
364
 
@@ -1,10 +1,8 @@
1
1
  module ViewComponentReflex
2
2
  class Engine < ::Rails::Engine
3
- class << self
4
- mattr_accessor :state_adapter
5
3
 
6
- self.state_adapter = StateAdapter::Session
7
- end
4
+ mattr_accessor :state_adapter
5
+ Engine.state_adapter = StateAdapter::Session
8
6
 
9
7
  config.to_prepare do
10
8
  StimulusReflex::Channel.class_eval do
@@ -40,7 +40,7 @@ module ViewComponentReflex
40
40
  element.dataset[:key]
41
41
  end
42
42
  end
43
- document = Nokogiri::HTML(controller.render_component_to_string(component))
43
+ document = Nokogiri::HTML(component.render_in(controller.view_context))
44
44
  cable_ready[channel.stream_name].morph(
45
45
  selector: selector,
46
46
  children_only: true,
@@ -1,3 +1,3 @@
1
1
  module ViewComponentReflex
2
- VERSION = '2.6.0'
2
+ VERSION = '2.6.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_component_reflex
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.0
4
+ version: 2.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua LeBlanc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-17 00:00:00.000000000 Z
11
+ date: 2020-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -34,16 +34,22 @@ dependencies:
34
34
  name: stimulus_reflex
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: 3.3.0
40
+ - - "<"
41
+ - !ruby/object:Gem::Version
42
+ version: '3.4'
40
43
  type: :runtime
41
44
  prerelease: false
42
45
  version_requirements: !ruby/object:Gem::Requirement
43
46
  requirements:
44
- - - "~>"
47
+ - - ">="
45
48
  - !ruby/object:Gem::Version
46
49
  version: 3.3.0
50
+ - - "<"
51
+ - !ruby/object:Gem::Version
52
+ version: '3.4'
47
53
  - !ruby/object:Gem::Dependency
48
54
  name: view_component
49
55
  requirement: !ruby/object:Gem::Requirement