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 +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/phlex/reactive/streamable.rb +12 -4
- data/lib/phlex/reactive/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 11c82575cc72017be4f81341c0c2f999d626fe88ed8b81a20cfde246a412fe12
|
|
4
|
+
data.tar.gz: '0996ececdc33cd2220a7a6517d49d1a59c5c583af891b937f1df32f433189a65'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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`.
|
|
31
|
-
#
|
|
32
|
-
#
|
|
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
|
-
|
|
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)
|