You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suggest to at least try to change the behavior of Form.updateField to expose an updater function to update the requested field record.
Why
Right now propsPatch is an Object which gets converted to Immutable (1) and then merged (2) with the record via fieldRecord.merge(fromJS(propsPatch)). Those are two costly procedures and they should be avoided.
Exposing the requested fieldRecord inside a custom updater function would mean that that record can be modified right away, without conversion or merging. All the data needed for update is available to compose propsPatch, anyway.
I wonder how this change would affect the dynamic props patch updates (i.e. for dynamic props change subscriptions).
With the current approach it's enough to just pass changedProps or similar object as the value of propsPatch. Once there is an updater function, what is the approach here? Merging can still be expensive, and assignment within the iteration will be as well.
kettanaito
changed the title
Form.updateField: Use "updater" function instead of "propsPatch"
Form.updateField: Use "update" function instead of "propsPatch"
Apr 2, 2018
What
I suggest to at least try to change the behavior of
Form.updateField
to expose anupdater
function to update the requested field record.Why
Right now
propsPatch
is an Object which gets converted to Immutable (1) and then merged (2) with the record viafieldRecord.merge(fromJS(propsPatch))
. Those are two costly procedures and they should be avoided.Exposing the requested
fieldRecord
inside a custom updater function would mean that that record can be modified right away, without conversion or merging. All the data needed for update is available to composepropsPatch
, anyway.How
Keynotes
Form.updateField()
do after the introduction of this change. Would it still be worthy to isolated into a separate method?The text was updated successfully, but these errors were encountered: