phlex-reactive 0.2.1 → 0.2.2

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: 458474fb8c8cdba105626b01860a196a32ebd144cbc79fd9140dc5fce937924f
4
- data.tar.gz: 214a174853a11f054ed246a9cd5fa16c96133aaaf65c1eaa07716f9c61db1eb3
3
+ metadata.gz: 11c82575cc72017be4f81341c0c2f999d626fe88ed8b81a20cfde246a412fe12
4
+ data.tar.gz: '0996ececdc33cd2220a7a6517d49d1a59c5c583af891b937f1df32f433189a65'
5
5
  SHA512:
6
- metadata.gz: d4d6d052aa218e41555dc1d94ff4966e93dff8420dda1402974b470bff49050d4864c1d003c7ef6a2e27d33bbf1ef69bf3e384a8e9ac554d163ab59bdfa2a6e8
7
- data.tar.gz: 713f21d6a6155e6dd11923ac756428868aac85074e82c969a1133863f68328a83547a5177d27b1b656a162d2363b352d7aaeaf5af79cdd5768ac86c043fe97d9
6
+ metadata.gz: 24b3704443cd08380e30bb2bd4340d266a75a39beb80247a4ba26327a4c6f6429b0017fc94618b4063dc4f00a7a86f49ab88074c008d9be1c2ead0b266b5c8cd
7
+ data.tar.gz: 4f858ded4f109ce0350603140572b4d9c694acd981785ac1913c0cf4c48630e6927d223073cd89fbb1f6a72e16bf7cea0603079661fff7b80740a4389ccbe732
data/CHANGELOG.md CHANGED
@@ -6,6 +6,22 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ### Fixed
10
+
11
+ - **Record-backed component built with a different init keyword by the action
12
+ endpoint vs the broadcast path.** The click path (`Component.from_identity`)
13
+ builds with `reactive_record_key` (the `reactive_record :name`), but the
14
+ broadcast path (`Streamable.build` → `model_param_name`) built with the
15
+ demodulized, underscored class name. They only agreed when the class name
16
+ happened to equal the record name — otherwise one path worked and the other
17
+ raised `ArgumentError: missing keyword`. The README's own `Todos::Item`
18
+ (`reactive_record :todo`, `Item` ≠ `todo`) hit this on broadcast.
19
+ `model_param_name` now prefers `reactive_record_key` when set, so a single
20
+ `initialize(<record>:)` satisfies both clicks and broadcasts. `Streamable`-only
21
+ components (no `reactive_record`) keep the demodulized-class-name default, and
22
+ an explicit `def self.model_param_name` override still wins. No API changes.
23
+ Closes #4.
24
+
9
25
  ## [0.2.1]
10
26
 
11
27
  ### Fixed
@@ -27,11 +27,19 @@ module Phlex
27
27
  extend ActiveSupport::Concern
28
28
 
29
29
  class_methods do
30
- # The keyword the positional model maps to in `initialize`. Convention:
31
- # demodulized, underscored class name (Invoice -> :invoice,
32
- # InvoiceItem -> :invoice_item). Override when it differs.
30
+ # The keyword the positional model maps to in `initialize`. For a
31
+ # record-backed component (Component#reactive_record), this is the SAME
32
+ # keyword the action endpoint uses in `from_identity` — so one
33
+ # `initialize(<record>:)` satisfies BOTH the click path and the
34
+ # broadcast path. Otherwise it falls back to the demodulized, underscored
35
+ # class name (Invoice -> :invoice, InvoiceItem -> :invoice_item).
36
+ # Override when it differs.
33
37
  def model_param_name
34
- name.demodulize.underscore.to_sym
38
+ if respond_to?(:reactive_record_key) && reactive_record_key
39
+ reactive_record_key
40
+ else
41
+ name.demodulize.underscore.to_sym
42
+ end
35
43
  end
36
44
 
37
45
  def component_args(model, options)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlex
4
4
  module Reactive
5
- VERSION = "0.2.1"
5
+ VERSION = "0.2.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex-reactive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson