phlex-reactive 0.15.0 → 0.15.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.
@@ -93,14 +93,23 @@ module Phlex
93
93
  # after_commit broadcasts behave.
94
94
  # 5. authorization — a registered authorization error RAISES (the endpoint
95
95
  # maps it to 403; a unit test asserts the real exception).
96
- def run_reactive(component, action, **params)
96
+ #
97
+ # `held:` stands in for the X-Reactive-Held header (issue #370): the field
98
+ # names a morph held over a changed server value, filtered to the action's
99
+ # declared params exactly as the endpoint filters them, and returned by
100
+ # reactive_held_fields inside the action. `held` is therefore reserved
101
+ # here: an action param literally named `held` can't be passed through.
102
+ #
103
+ # run_reactive(form, :save, held: ["title"], title: "Draft by B")
104
+ def run_reactive(component, action, held: [], **params)
97
105
  klass = component.class
98
106
  action_def = klass.reactive_actions[action.to_sym] || raise_undeclared(klass, action)
99
107
 
100
108
  rebuilt = rebuild_from_identity(component, klass)
101
109
  coerced = action_def.schema.coerce(stringify_params(params))
102
110
 
103
- returned = run_reactive_action(rebuilt, action_def, coerced)
111
+ held_fields = Phlex::Reactive::HeldFields.parse(Array(held).map(&:to_s).to_json, action_def)
112
+ returned = Phlex::Reactive::HeldFields.with(held_fields) { run_reactive_action(rebuilt, action_def, coerced) }
104
113
  Result.new(returned:, component: rebuilt)
105
114
  end
106
115
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Phlex
4
4
  module Reactive
5
- VERSION = "0.15.0"
5
+ VERSION = "0.15.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.15.0
4
+ version: 0.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
@@ -198,6 +198,7 @@ files:
198
198
  - lib/phlex/reactive/component/helpers.rb
199
199
  - lib/phlex/reactive/component/identity.rb
200
200
  - lib/phlex/reactive/component/lazy.rb
201
+ - lib/phlex/reactive/component/media_binding.rb
201
202
  - lib/phlex/reactive/component/presence_declaration.rb
202
203
  - lib/phlex/reactive/component/registry.rb
203
204
  - lib/phlex/reactive/component/selection.rb
@@ -210,6 +211,7 @@ files:
210
211
  - lib/phlex/reactive/effects.rb
211
212
  - lib/phlex/reactive/engine.rb
212
213
  - lib/phlex/reactive/fragment.rb
214
+ - lib/phlex/reactive/held_fields.rb
213
215
  - lib/phlex/reactive/inspector.rb
214
216
  - lib/phlex/reactive/inspector/report.rb
215
217
  - lib/phlex/reactive/js.rb