view_component_reflex 3.0.0 → 3.0.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: 047aa78feb4675abeb3bb5a5ed86ea4071c6a22fef3e06fb2806b04d651898cd
4
- data.tar.gz: 5c0cc3c3c6fca877e8b2d8a595c601ddea90b892a62367af6abed6099a6b1b81
3
+ metadata.gz: fd12cbedeb181b9389a65e4901face3177c25119271670a82f248231766a826f
4
+ data.tar.gz: fd3aa8f8be029de4cf2d4df8eaa2d5ea547bfab8c516b69fd7f0679e1bf7228c
5
5
  SHA512:
6
- metadata.gz: 0f3f2e6f15c43e47aa3cdcd39632f4e2d7d76dd7065dcfd38b718db0e34ac100fed7268371660994c402a9c0aacd07635a935f088cec49cebbbcbccae6533aea
7
- data.tar.gz: 56fa191797a8d3f757457a7a8c94f4394304ca0dd201639c0d47225a7f7be7ceb9b349641805783538325e884431e483a5b51714c4f75f26826912c953474d7c
6
+ metadata.gz: ff9e3b45405d40e177418be668eb4af5e8818f228f8aeda15ed5ff5569568b09b1426a4f6c399abb0ba7d043d37617a368cdc927e64203a49774b82251894367
7
+ data.tar.gz: 4e94514bef586bff85ff0be7fdda9df1c5d03da6691471ad4812ef1ca9854f1ef4beb990c2f729c8c4fc7100c535090c0586b584dcbe81a3e03c261d0a1c3bef
data/README.md CHANGED
@@ -359,6 +359,21 @@ end
359
359
 
360
360
  StimulusReflex 3.4 introduced a fix that merges the current `request.env` and provides the CSRF token to fetch the session.
361
361
 
362
+ ## Help, my instance variables do not persist into the session
363
+
364
+ These instance variable names are not working and unsafe:
365
+
366
+ ```rb
367
+ def unsafe_instance_variables
368
+ [
369
+ :@view_context, :@lookup_context, :@view_renderer, :@view_flow,
370
+ :@virtual_path, :@variant, :@current_template, :@output_buffer, :@key,
371
+ :@helpers, :@controller, :@request, :@tag_builder, :@initialized_state
372
+ ]
373
+ end
374
+ ```
375
+ Please use a different name to be able to save them to the session.
376
+
362
377
  ## Anycable
363
378
 
364
379
  @sebyx07 provided a solution to use anycable (https://github.com/joshleblanc/view_component_reflex/issues/23#issue-721786338)
@@ -13,13 +13,16 @@ module ViewComponentReflex
13
13
  reflex_name, _ = target.split("#")
14
14
  reflex_name = reflex_name.camelize
15
15
  component_name = reflex_name.end_with?("Reflex") ? reflex_name[0...-6] : reflex_name
16
- if component_name.end_with?("Component")
17
- begin
18
- component_name.constantize.init_stimulus_reflex
19
- rescue
20
- p "Tried to initialize view_component_reflex on #{component_name}, but it's not a view_component_reflex"
21
- end
16
+ component = begin
17
+ component_name.constantize
18
+ rescue
19
+ # Since every reflex runs through this monkey patch, we're just going to ignore the ones that aren't for components
20
+ end
22
21
 
22
+ if component&.respond_to?(:init_stimulus_reflex)
23
+ component.init_stimulus_reflex
24
+ else
25
+ p "Tried to initialize view_component_reflex on #{component_name}, but it's not a view_component_reflex"
23
26
  end
24
27
  receive_original(data)
25
28
  end
@@ -1,3 +1,3 @@
1
1
  module ViewComponentReflex
2
- VERSION = '3.0.0'
2
+ VERSION = '3.0.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: 3.0.0
4
+ version: 3.0.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-12-06 00:00:00.000000000 Z
11
+ date: 2020-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - '='
38
38
  - !ruby/object:Gem::Version
39
- version: 3.4.0.pre8
39
+ version: 3.4.0.pre9
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 3.4.0.pre8
46
+ version: 3.4.0.pre9
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: view_component
49
49
  requirement: !ruby/object:Gem::Requirement