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: b0c408bc69906500eee92927b43eb4f307039d4faab5e6fda80b5461ba922db0
4
- data.tar.gz: 6ccf997e199cdd409138b48b187199b55c625dcdb165aabb808c2ed0657a23f6
3
+ metadata.gz: 6897d1bd7689445185a2a06d80b868778d1dca89fa15bf1cbbc81ac31ce2ccb2
4
+ data.tar.gz: a285c182b5fea6ab970d8d0f609237f81a98d7724d95c88a8f595dce121b361f
5
5
  SHA512:
6
- metadata.gz: 689c1ffeab1b2b2c93b7df69765a9a0660c9cd5c215704b63cd5ac9128d152ac34bd39b0f8934b2798e37a649b3d6b2486aad3cf97d977f0cf3c374885f42a92
7
- data.tar.gz: 6596df41e9f41b447e9e8365c5f7c1fd8603fca4212eb2f15e429278a78e65c09c929edf753d353f1f65311533c9018bdcb4236aadf0d47a97a4964cdbb6af71
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
@@ -10,7 +10,7 @@ module ReactiveComponent
10
10
  component_class.execute_action(
11
11
  params[:action_name],
12
12
  record,
13
- params.fetch(:params, {}).permit!.to_h
13
+ params.fetch(:params, {})
14
14
  )
15
15
 
16
16
  head :ok
@@ -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 "reactive_component/lib/reactive_renderer_utils"
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) => {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ReactiveComponent
4
- VERSION = '0.6.2'
4
+ VERSION = '0.7.1'
5
5
  end
@@ -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).map(&:to_sym) }
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
- allowed = action_config[:params]
217
- if allowed.any?
218
- filtered = action_params.symbolize_keys.slice(*allowed)
219
- instance.send(action_name, **filtered)
220
- else
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactive_component
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Przemyslaw Lusar