File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
src/main/com/fulcrologic/fulcro/dom Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change 35
35
(let [{:keys [value onChange]} (comp/props this)
36
36
nsv (evt/target-value evt)
37
37
nv (string->model nsv)]
38
- (comp/set-state! this {:stringValue nsv
39
- :oldPropValue value
40
- :value nv})
38
+ (comp/set-state! this {:stringValue nsv
39
+ :oldPropValue value
40
+ :cacheValue nv
41
+ :cacheInvalid? false })
41
42
(when (and onChange (not= value nv))
42
43
(onChange nv))))
43
- :stringValue (model->string value)}]
44
+ :stringValue (model->string value)
45
+ :cacheInvalid? true }]
44
46
(set! (.-state this) (cljs.core/js-obj " fulcro$state" initial-state)))
45
47
nil )))]
46
48
(comp/configure-component! cls kw
47
49
{:getDerivedStateFromProps
48
50
(fn [latest-props state]
49
51
(let [{:keys [value]} latest-props
50
- {:keys [oldPropValue stringValue]} state
51
- ignorePropValue? (or (= oldPropValue value) (= value (:value state)))
52
+ {:keys [oldPropValue stringValue cacheValue cacheInvalid?]} state
53
+ ignorePropValue? (or (= oldPropValue value) (when-not cacheInvalid? (= value cacheValue)))
54
+ cacheInvalid? (or cacheInvalid? ignorePropValue?)
52
55
stringValue (cond-> (if ignorePropValue?
53
56
stringValue
54
57
(model->string value))
55
58
string-filter string-filter)
56
- new-derived-state (merge state {:stringValue stringValue :oldPropValue value})]
59
+ new-derived-state (merge state {:stringValue stringValue :oldPropValue value :cacheInvalid? cacheInvalid? })]
57
60
#js {" fulcro$state" new-derived-state}))
58
61
:render
59
62
(fn [this]
You can’t perform that action at this time.
0 commit comments