Skip to content

Allow to pass value from top#2

Open
alcedoatthis wants to merge 1 commit intomasterfrom
allow-passing-value
Open

Allow to pass value from top#2
alcedoatthis wants to merge 1 commit intomasterfrom
allow-passing-value

Conversation

@alcedoatthis
Copy link

Useful e.g. for check/uncheck all checkbox. Value can be combined from other values and passed directly to check-all checkbox. IMHO it is better to move {...rest} props below others, but I'm not sure if this behaviour is wanted (?)

@alcedoatthis alcedoatthis self-assigned this Mar 9, 2017
@ondrejbartas
Copy link
Contributor

@alcedoatthis this does not make any sense, without value from connected state you don't need onion form at all..

@alcedoatthis
Copy link
Author

alcedoatthis commented Mar 10, 2017

@ondrejbartas Current api is kept, if You don't pass value as a prop to component. Is there any example of functionality mentioned? IMHO other options like hooking setFieldValue into componentWillReceiveProps seems to be hacky. What about optional argument to connectField? mergeProps(stateProps, dispatchProps, ownProps): props passed to connect. Something like:

export default function connectField(fieldName, ..., mergeProps) {
  return FieldComponent => {
    @connect(
      (state, { onionFormName }) => ({...}),
      (dispatch, { onionFormName }) => ({...}),
      mergeProps
    ) // ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants