reactive_component 0.6.2 → 0.7.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6897d1bd7689445185a2a06d80b868778d1dca89fa15bf1cbbc81ac31ce2ccb2
|
|
4
|
+
data.tar.gz: a285c182b5fea6ab970d8d0f609237f81a98d7724d95c88a8f595dce121b361f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d8c1a5eaddc568b0c8aa20e88a18e7631633d46d344892d447ed0bbe6b12513b7637c0b00794d19679ef2f3da13d1ba012a1559540f754f911c5b2f2179230f1
|
|
7
|
+
data.tar.gz: 1b6ec87280c44844c8b93350d21f255280bce22ed79cf192234c6319f1f30971f5e0947e34433c2ee19a72fde6535f31b3a7ccfe5dac3800a10fdc28e50f72fe
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.1] - 2026-09-06
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- The JavaScript is an npm package too: `package.json` exports
|
|
7
|
+
`reactive_component/controllers/*` and `reactive_component/lib/*`, so an app
|
|
8
|
+
can `npm install` the gem's GitHub tag tarball instead of aliasing the
|
|
9
|
+
bundler path (which a Node-only Docker stage cannot resolve).
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- The renderer controller imports its utils by relative path, so it resolves
|
|
13
|
+
without an alias or importmap pin for the lib file.
|
|
14
|
+
|
|
15
|
+
## [0.7.0] - 2026-09-06
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- `live_action` params are filtered with `permit` against the declared
|
|
19
|
+
list, so a nested hash or array sent for a scalar param no longer reaches
|
|
20
|
+
the action method.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
- `live_action` `params:` accepts the full `permit` spec, so an action can
|
|
24
|
+
declare arrays and nested hashes: `params: [:title, { tags: [] }]`.
|
|
25
|
+
|
|
3
26
|
## [0.6.2] - 2026-09-06
|
|
4
27
|
|
|
5
28
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Controller } from "@hotwired/stimulus"
|
|
2
2
|
import { createConsumer } from "@rails/actioncable"
|
|
3
|
-
import { compileTemplate, decompress, morphElement, buildActionBody, routeMessage, duplicateIds, strictData } from "
|
|
3
|
+
import { compileTemplate, decompress, morphElement, buildActionBody, routeMessage, duplicateIds, strictData } from "../lib/reactive_renderer_utils.js"
|
|
4
4
|
|
|
5
5
|
const consumer = createConsumer()
|
|
6
6
|
const log = (...args) => {
|
data/lib/reactive_component.rb
CHANGED
|
@@ -192,9 +192,12 @@ module ReactiveComponent
|
|
|
192
192
|
end
|
|
193
193
|
end
|
|
194
194
|
|
|
195
|
+
# `params:` takes the same spec as `ActionController::Parameters#permit`:
|
|
196
|
+
# live_action :move, params: [:label_id]
|
|
197
|
+
# live_action :save, params: [:title, { tags: [], address: [:city] }]
|
|
195
198
|
def live_action(action_name, params: [])
|
|
196
199
|
self._live_actions = _live_actions.merge(
|
|
197
|
-
action_name.to_sym => { params: Array(params)
|
|
200
|
+
action_name.to_sym => { params: Array(params) }
|
|
198
201
|
)
|
|
199
202
|
end
|
|
200
203
|
|
|
@@ -213,13 +216,11 @@ module ReactiveComponent
|
|
|
213
216
|
instance = allocate
|
|
214
217
|
instance.instance_variable_set(:"@#{live_model_attr}", record)
|
|
215
218
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
instance.send(action_name)
|
|
222
|
-
end
|
|
219
|
+
# `permit` (not `permit!` + slice): only declared keys, and only scalar
|
|
220
|
+
# values, so a nested hash or array never reaches the action method.
|
|
221
|
+
action_params = ActionController::Parameters.new(action_params) unless action_params.is_a?(ActionController::Parameters)
|
|
222
|
+
filtered = action_params.permit(*action_config[:params]).to_h.symbolize_keys
|
|
223
|
+
instance.send(action_name, **filtered)
|
|
223
224
|
end
|
|
224
225
|
|
|
225
226
|
def compiled_data
|