stimulus_reflex 3.4.0.pre5 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of stimulus_reflex might be problematic. Click here for more details.

Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +78 -2
  3. data/Gemfile.lock +76 -73
  4. data/README.md +5 -8
  5. data/Rakefile +5 -5
  6. data/app/channels/stimulus_reflex/channel.rb +22 -0
  7. data/bin/console +1 -0
  8. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/%file_name%_controller.js.tt +14 -2
  9. data/lib/generators/stimulus_reflex/templates/app/javascript/controllers/application_controller.js.tt +10 -2
  10. data/lib/generators/stimulus_reflex/templates/app/reflexes/%file_name%_reflex.rb.tt +19 -9
  11. data/lib/generators/stimulus_reflex/templates/app/reflexes/application_reflex.rb.tt +2 -2
  12. data/lib/generators/stimulus_reflex/templates/config/initializers/stimulus_reflex.rb +10 -1
  13. data/lib/stimulus_reflex.rb +2 -1
  14. data/lib/stimulus_reflex/broadcasters/broadcaster.rb +2 -4
  15. data/lib/stimulus_reflex/broadcasters/page_broadcaster.rb +2 -1
  16. data/lib/stimulus_reflex/broadcasters/selector_broadcaster.rb +2 -2
  17. data/lib/stimulus_reflex/cable_ready_channels.rb +21 -0
  18. data/lib/stimulus_reflex/configuration.rb +2 -1
  19. data/lib/stimulus_reflex/reflex.rb +16 -6
  20. data/lib/stimulus_reflex/sanity_checker.rb +18 -4
  21. data/lib/stimulus_reflex/version.rb +1 -1
  22. data/lib/tasks/stimulus_reflex/install.rake +8 -3
  23. data/package.json +3 -3
  24. data/stimulus_reflex.gemspec +3 -1
  25. data/tags +95 -37
  26. data/test/broadcasters/broadcaster_test.rb +3 -6
  27. data/test/broadcasters/broadcaster_test_case.rb +15 -0
  28. data/test/broadcasters/nothing_broadcaster_test.rb +27 -26
  29. data/test/broadcasters/page_broadcaster_test.rb +56 -50
  30. data/test/broadcasters/selector_broadcaster_test.rb +57 -83
  31. data/test/reflex_test.rb +32 -0
  32. data/test/test_helper.rb +43 -2
  33. data/test/tmp/app/reflexes/application_reflex.rb +2 -2
  34. data/test/tmp/app/reflexes/demo_reflex.rb +34 -0
  35. data/yarn.lock +199 -226
  36. metadata +13 -8
  37. data/test/tmp/app/reflexes/posts_reflex.rb +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a1744cbfb7c9c5508487beb3d0087c77b6cc532386ef503709aa0c0097b4f56e
4
- data.tar.gz: 99ce8b8d1ad3190d5cd90e49182b39ec959a39f3accb4784f2d0cccbfb7e6fe4
3
+ metadata.gz: 0e8a031b4ca8ec37431ba1833e979dd07a1bfcc9e91c76eb8ced068811b882a5
4
+ data.tar.gz: 9c0624e343247459836718dac05cc25b4a75d4952bcdbb15a175211785e8e174
5
5
  SHA512:
6
- metadata.gz: faccf3117f5cb17303725bab3ba659a77314e44908a1b5d1d5184e171b2635c44a10a42f7e19cbfefa6231a6488d1364b6b463a04e3438e1b92aff237545d515
7
- data.tar.gz: 126a3dc45916880d97b6ab1971dfb2a433b1d8e1c27b3c7a1c32a5d0b55ee0ae7c50bfdb9b10901525520b0ae1e975a083125a26305147e62252464a872b15db
6
+ metadata.gz: 3abd618c996936a1e118ee552a95a97c6481014a008c32775d11c2c2c9ea1e1e691071c9a1e8016722fec7f66cb63049b57f0331b283e45704bdc7bb253dc888
7
+ data.tar.gz: 92f4c07b36962fb3d6858dcc8e051d8c584cb0851198574cfe77e8be580d77d4fbd5f4f6a6693b59a76c52be7cd614a0bf5b67cf536dfa8c80ed70391d87849c
@@ -2,7 +2,84 @@
2
2
 
3
3
  ## [Unreleased](https://github.com/hopsoft/stimulus_reflex/tree/HEAD)
4
4
 
5
- [Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre4...HEAD)
5
+ [Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre9...HEAD)
6
+
7
+ **Closed issues:**
8
+
9
+ - uninitialized constant StimulusReflex::Channel [\#408](https://github.com/hopsoft/stimulus_reflex/issues/408)
10
+ - StimulusReflex \(3.4.0.pre9\) was unable to find an element [\#406](https://github.com/hopsoft/stimulus_reflex/issues/406)
11
+
12
+ ## [v3.4.0.pre9](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre9) (2020-12-13)
13
+
14
+ [Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre8...v3.4.0.pre9)
15
+
16
+ **Implemented enhancements:**
17
+
18
+ - Allow StimulusReflex to process Rack middlewares [\#399](https://github.com/hopsoft/stimulus_reflex/pull/399) ([marcoroth](https://github.com/marcoroth))
19
+ - Support for Stimulus 2 [\#398](https://github.com/hopsoft/stimulus_reflex/pull/398) ([marcoroth](https://github.com/marcoroth))
20
+
21
+ **Fixed bugs:**
22
+
23
+ - fix up install task [\#401](https://github.com/hopsoft/stimulus_reflex/pull/401) ([leastbad](https://github.com/leastbad))
24
+ - Fix multiple broadcasts from within the same reflex [\#400](https://github.com/hopsoft/stimulus_reflex/pull/400) ([hopsoft](https://github.com/hopsoft))
25
+
26
+ **Closed issues:**
27
+
28
+ - Sanity checker will fail if node\_modules folder isn't present [\#402](https://github.com/hopsoft/stimulus_reflex/issues/402)
29
+ - stimulus\_reflex.js:388 Uncaught TypeError: Cannot read property 'completedOperations' of undefined [\#394](https://github.com/hopsoft/stimulus_reflex/issues/394)
30
+ - Rendering issue [\#289](https://github.com/hopsoft/stimulus_reflex/issues/289)
31
+
32
+ **Merged pull requests:**
33
+
34
+ - Add dom\_id to the reflex [\#405](https://github.com/hopsoft/stimulus_reflex/pull/405) ([hopsoft](https://github.com/hopsoft))
35
+ - Don't run sanity checker in production [\#404](https://github.com/hopsoft/stimulus_reflex/pull/404) ([joshleblanc](https://github.com/joshleblanc))
36
+ - Check package version from yarn.lock if node\_modules folder is not av… [\#403](https://github.com/hopsoft/stimulus_reflex/pull/403) ([RolandStuder](https://github.com/RolandStuder))
37
+
38
+ ## [v3.4.0.pre8](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre8) (2020-12-02)
39
+
40
+ [Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre7...v3.4.0.pre8)
41
+
42
+ **Closed issues:**
43
+
44
+ - DirectUpload URL not set using morphs [\#396](https://github.com/hopsoft/stimulus_reflex/issues/396)
45
+
46
+ **Merged pull requests:**
47
+
48
+ - Delegate render to controller [\#397](https://github.com/hopsoft/stimulus_reflex/pull/397) ([hopsoft](https://github.com/hopsoft))
49
+
50
+ ## [v3.4.0.pre7](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre7) (2020-12-01)
51
+
52
+ [Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre6...v3.4.0.pre7)
53
+
54
+ **Closed issues:**
55
+
56
+ - Multiple reflex submissions can lead to unexpected behaviour. [\#391](https://github.com/hopsoft/stimulus_reflex/issues/391)
57
+
58
+ **Merged pull requests:**
59
+
60
+ - Trigger piggy back operations after SR operations [\#395](https://github.com/hopsoft/stimulus_reflex/pull/395) ([hopsoft](https://github.com/hopsoft))
61
+ - `invokeLifecycleMethod\(\)`: handle undefined `element` parameter [\#393](https://github.com/hopsoft/stimulus_reflex/pull/393) ([marcoroth](https://github.com/marcoroth))
62
+ - don't warn folks twice [\#392](https://github.com/hopsoft/stimulus_reflex/pull/392) ([leastbad](https://github.com/leastbad))
63
+
64
+ ## [v3.4.0.pre6](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre6) (2020-11-29)
65
+
66
+ [Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre5...v3.4.0.pre6)
67
+
68
+ **Merged pull requests:**
69
+
70
+ - Update templates for new stage etc [\#390](https://github.com/hopsoft/stimulus_reflex/pull/390) ([leastbad](https://github.com/leastbad))
71
+ - reflexError and received refactor [\#389](https://github.com/hopsoft/stimulus_reflex/pull/389) ([leastbad](https://github.com/leastbad))
72
+ - add jQuery support to SR library events [\#388](https://github.com/hopsoft/stimulus_reflex/pull/388) ([leastbad](https://github.com/leastbad))
73
+ - dont exit in sanity checker on `stimulus\_reflex:install` [\#387](https://github.com/hopsoft/stimulus_reflex/pull/387) ([marcoroth](https://github.com/marcoroth))
74
+ - Allow `success` and `after` lifecycle methods on replaced elements [\#386](https://github.com/hopsoft/stimulus_reflex/pull/386) ([marcoroth](https://github.com/marcoroth))
75
+ - split SR operations from data.operations [\#385](https://github.com/hopsoft/stimulus_reflex/pull/385) ([leastbad](https://github.com/leastbad))
76
+ - don't show findElement warnings unless debugging [\#384](https://github.com/hopsoft/stimulus_reflex/pull/384) ([leastbad](https://github.com/leastbad))
77
+ - Setup a proxy object that wraps CableReady::Channels [\#382](https://github.com/hopsoft/stimulus_reflex/pull/382) ([hopsoft](https://github.com/hopsoft))
78
+ - non-SR cable\_ready operation pass-through [\#381](https://github.com/hopsoft/stimulus_reflex/pull/381) ([leastbad](https://github.com/leastbad))
79
+
80
+ ## [v3.4.0.pre5](https://github.com/hopsoft/stimulus_reflex/tree/v3.4.0.pre5) (2020-11-25)
81
+
82
+ [Full Changelog](https://github.com/hopsoft/stimulus_reflex/compare/v3.4.0.pre4...v3.4.0.pre5)
6
83
 
7
84
  **Closed issues:**
8
85
 
@@ -97,7 +174,6 @@
97
174
  - ActionController::RoutingError with Rails 6 Engines [\#342](https://github.com/hopsoft/stimulus_reflex/issues/342)
98
175
  - Wrong input name parsing [\#321](https://github.com/hopsoft/stimulus_reflex/issues/321)
99
176
  - Stimulus' controllers are not reconnecting after reflex, why? [\#314](https://github.com/hopsoft/stimulus_reflex/issues/314)
100
- - Rendering issue [\#289](https://github.com/hopsoft/stimulus_reflex/issues/289)
101
177
  - Documentation Request for a Rails 6.x app with 5.2 defaults [\#265](https://github.com/hopsoft/stimulus_reflex/issues/265)
102
178
 
103
179
  **Merged pull requests:**
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- stimulus_reflex (3.4.0.pre5)
5
- cable_ready (>= 4.3.0)
4
+ stimulus_reflex (3.4.0)
5
+ cable_ready (>= 4.4)
6
6
  nokogiri
7
7
  rack
8
8
  rails (>= 5.2)
@@ -11,64 +11,68 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (6.0.3.4)
15
- actionpack (= 6.0.3.4)
14
+ actioncable (6.1.0)
15
+ actionpack (= 6.1.0)
16
+ activesupport (= 6.1.0)
16
17
  nio4r (~> 2.0)
17
18
  websocket-driver (>= 0.6.1)
18
- actionmailbox (6.0.3.4)
19
- actionpack (= 6.0.3.4)
20
- activejob (= 6.0.3.4)
21
- activerecord (= 6.0.3.4)
22
- activestorage (= 6.0.3.4)
23
- activesupport (= 6.0.3.4)
19
+ actionmailbox (6.1.0)
20
+ actionpack (= 6.1.0)
21
+ activejob (= 6.1.0)
22
+ activerecord (= 6.1.0)
23
+ activestorage (= 6.1.0)
24
+ activesupport (= 6.1.0)
24
25
  mail (>= 2.7.1)
25
- actionmailer (6.0.3.4)
26
- actionpack (= 6.0.3.4)
27
- actionview (= 6.0.3.4)
28
- activejob (= 6.0.3.4)
26
+ actionmailer (6.1.0)
27
+ actionpack (= 6.1.0)
28
+ actionview (= 6.1.0)
29
+ activejob (= 6.1.0)
30
+ activesupport (= 6.1.0)
29
31
  mail (~> 2.5, >= 2.5.4)
30
32
  rails-dom-testing (~> 2.0)
31
- actionpack (6.0.3.4)
32
- actionview (= 6.0.3.4)
33
- activesupport (= 6.0.3.4)
34
- rack (~> 2.0, >= 2.0.8)
33
+ actionpack (6.1.0)
34
+ actionview (= 6.1.0)
35
+ activesupport (= 6.1.0)
36
+ rack (~> 2.0, >= 2.0.9)
35
37
  rack-test (>= 0.6.3)
36
38
  rails-dom-testing (~> 2.0)
37
39
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
38
- actiontext (6.0.3.4)
39
- actionpack (= 6.0.3.4)
40
- activerecord (= 6.0.3.4)
41
- activestorage (= 6.0.3.4)
42
- activesupport (= 6.0.3.4)
40
+ actiontext (6.1.0)
41
+ actionpack (= 6.1.0)
42
+ activerecord (= 6.1.0)
43
+ activestorage (= 6.1.0)
44
+ activesupport (= 6.1.0)
43
45
  nokogiri (>= 1.8.5)
44
- actionview (6.0.3.4)
45
- activesupport (= 6.0.3.4)
46
+ actionview (6.1.0)
47
+ activesupport (= 6.1.0)
46
48
  builder (~> 3.1)
47
49
  erubi (~> 1.4)
48
50
  rails-dom-testing (~> 2.0)
49
51
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
50
- activejob (6.0.3.4)
51
- activesupport (= 6.0.3.4)
52
+ activejob (6.1.0)
53
+ activesupport (= 6.1.0)
52
54
  globalid (>= 0.3.6)
53
- activemodel (6.0.3.4)
54
- activesupport (= 6.0.3.4)
55
- activerecord (6.0.3.4)
56
- activemodel (= 6.0.3.4)
57
- activesupport (= 6.0.3.4)
58
- activestorage (6.0.3.4)
59
- actionpack (= 6.0.3.4)
60
- activejob (= 6.0.3.4)
61
- activerecord (= 6.0.3.4)
55
+ activemodel (6.1.0)
56
+ activesupport (= 6.1.0)
57
+ activerecord (6.1.0)
58
+ activemodel (= 6.1.0)
59
+ activesupport (= 6.1.0)
60
+ activestorage (6.1.0)
61
+ actionpack (= 6.1.0)
62
+ activejob (= 6.1.0)
63
+ activerecord (= 6.1.0)
64
+ activesupport (= 6.1.0)
62
65
  marcel (~> 0.3.1)
63
- activesupport (6.0.3.4)
66
+ mimemagic (~> 0.3.2)
67
+ activesupport (6.1.0)
64
68
  concurrent-ruby (~> 1.0, >= 1.0.2)
65
- i18n (>= 0.7, < 2)
66
- minitest (~> 5.1)
67
- tzinfo (~> 1.1)
68
- zeitwerk (~> 2.2, >= 2.2.2)
69
+ i18n (>= 1.6, < 2)
70
+ minitest (>= 5.1)
71
+ tzinfo (~> 2.0)
72
+ zeitwerk (~> 2.3)
69
73
  ast (2.4.1)
70
74
  builder (3.2.4)
71
- cable_ready (4.4.0)
75
+ cable_ready (4.4.6)
72
76
  rails (>= 5.2)
73
77
  coderay (1.1.3)
74
78
  concurrent-ruby (1.1.7)
@@ -78,7 +82,7 @@ GEM
78
82
  activesupport (>= 4.2.0)
79
83
  i18n (1.8.5)
80
84
  concurrent-ruby (~> 1.0)
81
- loofah (2.7.0)
85
+ loofah (2.8.0)
82
86
  crass (~> 1.0.2)
83
87
  nokogiri (>= 1.5.9)
84
88
  mail (2.7.1)
@@ -104,50 +108,50 @@ GEM
104
108
  rack (2.2.3)
105
109
  rack-test (1.1.0)
106
110
  rack (>= 1.0, < 3)
107
- rails (6.0.3.4)
108
- actioncable (= 6.0.3.4)
109
- actionmailbox (= 6.0.3.4)
110
- actionmailer (= 6.0.3.4)
111
- actionpack (= 6.0.3.4)
112
- actiontext (= 6.0.3.4)
113
- actionview (= 6.0.3.4)
114
- activejob (= 6.0.3.4)
115
- activemodel (= 6.0.3.4)
116
- activerecord (= 6.0.3.4)
117
- activestorage (= 6.0.3.4)
118
- activesupport (= 6.0.3.4)
119
- bundler (>= 1.3.0)
120
- railties (= 6.0.3.4)
111
+ rails (6.1.0)
112
+ actioncable (= 6.1.0)
113
+ actionmailbox (= 6.1.0)
114
+ actionmailer (= 6.1.0)
115
+ actionpack (= 6.1.0)
116
+ actiontext (= 6.1.0)
117
+ actionview (= 6.1.0)
118
+ activejob (= 6.1.0)
119
+ activemodel (= 6.1.0)
120
+ activerecord (= 6.1.0)
121
+ activestorage (= 6.1.0)
122
+ activesupport (= 6.1.0)
123
+ bundler (>= 1.15.0)
124
+ railties (= 6.1.0)
121
125
  sprockets-rails (>= 2.0.0)
122
126
  rails-dom-testing (2.0.3)
123
127
  activesupport (>= 4.2.0)
124
128
  nokogiri (>= 1.6)
125
129
  rails-html-sanitizer (1.3.0)
126
130
  loofah (~> 2.3)
127
- railties (6.0.3.4)
128
- actionpack (= 6.0.3.4)
129
- activesupport (= 6.0.3.4)
131
+ railties (6.1.0)
132
+ actionpack (= 6.1.0)
133
+ activesupport (= 6.1.0)
130
134
  method_source
131
135
  rake (>= 0.8.7)
132
- thor (>= 0.20.3, < 2.0)
136
+ thor (~> 1.0)
133
137
  rainbow (3.0.0)
134
138
  rake (13.0.1)
135
139
  redis (4.2.5)
136
140
  regexp_parser (2.0.0)
137
141
  rexml (3.2.4)
138
- rubocop (1.2.0)
142
+ rubocop (1.4.2)
139
143
  parallel (~> 1.10)
140
144
  parser (>= 2.7.1.5)
141
145
  rainbow (>= 2.2.2, < 4.0)
142
146
  regexp_parser (>= 1.8)
143
147
  rexml
144
- rubocop-ast (>= 1.0.1)
148
+ rubocop-ast (>= 1.1.1)
145
149
  ruby-progressbar (~> 1.7)
146
150
  unicode-display_width (>= 1.4.0, < 2.0)
147
- rubocop-ast (1.2.0)
151
+ rubocop-ast (1.3.0)
148
152
  parser (>= 2.7.1.5)
149
- rubocop-performance (1.8.1)
150
- rubocop (>= 0.87.0)
153
+ rubocop-performance (1.9.1)
154
+ rubocop (>= 0.90.0, < 2.0)
151
155
  rubocop-ast (>= 0.4.0)
152
156
  ruby-progressbar (1.10.1)
153
157
  sprockets (4.0.2)
@@ -157,20 +161,19 @@ GEM
157
161
  actionpack (>= 4.0)
158
162
  activesupport (>= 4.0)
159
163
  sprockets (>= 3.0.0)
160
- standard (0.9.0)
161
- rubocop (= 1.2.0)
162
- rubocop-performance (= 1.8.1)
164
+ standard (0.10.2)
165
+ rubocop (= 1.4.2)
166
+ rubocop-performance (= 1.9.1)
163
167
  standardrb (1.0.0)
164
168
  standard
165
169
  thor (1.0.1)
166
- thread_safe (0.3.6)
167
- tzinfo (1.2.8)
168
- thread_safe (~> 0.1)
170
+ tzinfo (2.0.4)
171
+ concurrent-ruby (~> 1.0)
169
172
  unicode-display_width (1.7.0)
170
173
  websocket-driver (0.7.3)
171
174
  websocket-extensions (>= 0.1.0)
172
175
  websocket-extensions (0.1.5)
173
- zeitwerk (2.4.1)
176
+ zeitwerk (2.4.2)
174
177
 
175
178
  PLATFORMS
176
179
  ruby
data/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  <img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-brightgreen.svg" target="_blank" />
12
12
  </a>
13
13
  <a href="http://blog.codinghorror.com/the-best-code-is-no-code-at-all/" target="_blank">
14
- <img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-1506-brightgreen.svg?style=flat" />
14
+ <img alt="Lines of Code" src="https://img.shields.io/badge/lines_of_code-1632-brightgreen.svg?style=flat" />
15
15
  </a>
16
16
  <a href="https://docs.stimulusreflex.com/" target="_blank">
17
17
  <img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" />
@@ -30,9 +30,6 @@
30
30
  <a href="https://www.codacy.com/manual/hopsoft/stimulus_reflex/dashboard?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=hopsoft/stimulus_reflex&amp;utm_campaign=Badge_Grade" target="_blank">
31
31
  <img alt="Code Quality" src="https://app.codacy.com/project/badge/Grade/d1d72a7060f5467b8696884351cf477f"/>
32
32
  </a>
33
- <a href="https://codeclimate.com/github/hopsoft/stimulus_reflex/maintainability" target="_blank">
34
- <img alt="Maintainability" src="https://api.codeclimate.com/v1/badges/2b24fdbd1ae37a24bedb/maintainability" />
35
- </a>
36
33
  <a target="_blank" rel="noopener noreferrer" href="https://github.com/hopsoft/stimulus_reflex/workflows/Prettier-Standard/badge.svg">
37
34
  <img src="https://github.com/hopsoft/stimulus_reflex/workflows/Prettier-Standard/badge.svg" alt="Prettier-Standard" style="max-width:100%;">
38
35
  </a>
@@ -77,7 +74,7 @@ This project strives to live up to the vision outlined in [The Rails Doctrine](h
77
74
 
78
75
  ## 👩‍👩‍👧 Discord Community
79
76
 
80
- Please join over 700 of us on [Discord](https://discord.gg/XveN625) for support getting started, as well as active discussions around Rails, StimulusJS and CableReady.
77
+ Please join over 800 of us on [Discord](https://discord.gg/XveN625) for support getting started, as well as active discussions around Rails, StimulusJS and CableReady.
81
78
 
82
79
  ![](https://img.shields.io/discord/629472241427415060)
83
80
 
@@ -85,13 +82,13 @@ Stop by #newcomers and introduce yourselves!
85
82
 
86
83
  ## 💙 Support
87
84
 
88
- Your best bet is to ask for help on Discord before filing an issue on Github. We are happy to help, and we ask people to come with all relevant code to look at. A git repo is preferred, but Gists or posts on [Discourse](https://stimulus-reflex.discourse.group) are fine, too.
85
+ Your best bet is to ask for help on Discord before filing an issue on Github. We are happy to help, and we ask people who need help to come with all relevant code to look at. A git repo is preferred, but Gists are fine, too. If you need an MVCE template, try [this](https://github.com/leastbad/stimulus_reflex_harness).
89
86
 
90
87
  Please note that we are not actively providing support on Stack Overflow. If you post there, we likely won't see it.
91
88
 
92
- ## 🚀 Install
89
+ ## 🚀 Installation and upgrading
93
90
 
94
- CLI and manual setup procedures are fully detailed in the [official docs](https://docs.stimulusreflex.com/setup).
91
+ CLI and manual setup procedures are fully detailed in the [official docs](https://docs.stimulusreflex.com/setup). For information on upgrading existing projects to v3.4, read [this](https://docs.stimulusreflex.com/setup#upgrading-to-v-3-4-0).
95
92
 
96
93
  ## 🙏 Contributing
97
94
 
data/Rakefile CHANGED
@@ -3,13 +3,13 @@
3
3
  require "bundler/gem_tasks"
4
4
  require "rails/test_unit/runner"
5
5
 
6
- task default: [:test]
7
-
8
- task :test do |task|
9
- return 1 unless system("yarn run test")
10
- Rails::TestUnit::Runner.run
6
+ task :test_javascript do |task|
7
+ system "yarn run test"
11
8
  end
12
9
 
13
10
  task :test_ruby do |task|
14
11
  Rails::TestUnit::Runner.run
15
12
  end
13
+
14
+ task test: [:test_javascript, :test_ruby]
15
+ task default: [:test]
@@ -49,11 +49,33 @@ class StimulusReflex::Channel < StimulusReflex.configuration.parent_channel.cons
49
49
  rescue => invoke_error
50
50
  message = exception_message_with_backtrace(invoke_error)
51
51
  body = "Reflex #{target} failed: #{message} [#{url}]"
52
+
52
53
  if reflex
53
54
  reflex.rescue_with_handler(invoke_error)
54
55
  reflex.broadcast_message subject: "error", body: body, data: data, error: invoke_error
55
56
  else
56
57
  puts "\e[31m#{body}\e[0m"
58
+
59
+ if body.to_s.include? "No route matches"
60
+ initializer_path = Rails.root.join("config", "initializers", "stimulus_reflex.rb")
61
+
62
+ puts <<~NOTE
63
+ \e[33mNOTE: StimulusReflex failed to locate a matching route and could not re-render the page.
64
+
65
+ If your app uses Rack middleware to rewrite part of the request path, you must enable those middleware modules in StimulusReflex.
66
+ The StimulusReflex initializer should be located at #{initializer_path}, or you can generate it with:
67
+
68
+ $ bundle exec rails generate stimulus_reflex:config
69
+
70
+ Configure any required middleware:
71
+
72
+ StimulusReflex.configure do |config|
73
+ config.middleware.use FirstRackMiddleware
74
+ config.middleware.use SecondRackMiddleware
75
+ end\e[0m
76
+
77
+ NOTE
78
+ end
57
79
  end
58
80
  return
59
81
  end
@@ -4,4 +4,5 @@ require "bundler/setup"
4
4
  require "stimulus_reflex"
5
5
  require "pry"
6
6
 
7
+ StimulusReflex.configuration.parent_channel = "ActionCable::Channel::Base"
7
8
  Pry.start
@@ -56,12 +56,20 @@ export default class extends ApplicationController {
56
56
  // }
57
57
 
58
58
  // danceSuccess(element, reflex, noop, reflexId) {
59
- // element.innerText = 'Danced like no one was watching! Was someone watching?'
59
+ // element.innerText = '\nDanced like no one was watching! Was someone watching?'
60
60
  // }
61
61
 
62
62
  // danceError(element, reflex, error, reflexId) {
63
63
  // console.error('danceError', error);
64
- // element.innerText = "Couldn't dance!"
64
+ // element.innerText = "\nCouldn\'t dance!"
65
+ // }
66
+
67
+ // afterDance(element, reflex, noop, reflexId) {
68
+ // element.innerText = '\nWhatever that was, it\'s over now.'
69
+ // }
70
+
71
+ // finalizeDance(element, reflex, noop, reflexId) {
72
+ // element.innerText = '\nNow, the cleanup can begin!'
65
73
  // }
66
74
  <% end -%>
67
75
  <% actions.each do |action| -%>
@@ -84,6 +92,10 @@ export default class extends ApplicationController {
84
92
  // <%= "after_#{action}".camelize(:lower) %>(element, reflex, noop, reflexId) {
85
93
  // console.log("after <%= action %>", element, reflex, reflexId)
86
94
  // }
95
+
96
+ // <%= "finalize_#{action}".camelize(:lower) %>(element, reflex, noop, reflexId) {
97
+ // console.log("finalize <%= action %>", element, reflex, reflexId)
98
+ // }
87
99
  <%= "\n" unless action == actions.last -%>
88
100
  <% end -%>
89
101
  }