Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mutation element curly brace position #4312

Closed
JeffML opened this issue Jan 15, 2019 · 2 comments
Closed

Mutation element curly brace position #4312

JeffML opened this issue Jan 15, 2019 · 2 comments

Comments

@JeffML
Copy link

JeffML commented Jan 15, 2019

Intended outcome:

On a Mutation component, it seems that the block must begin on a new line after the start tag:

  {mDelete => (
    <Mutation mutation={UPSERT}>
      {mUpsert => (
        <input type="submit" value="Submit Changes" style={{ float: 'right' }}
          onClick={evt => submitAction({
            evt, returnTo: props.setPage, mDelete, mUpsert, refetch: props.refetch,
          })} />
      )}
    </Mutation>
  )}
</Mutation>;

Actual outcome:

if the curly brace is placed immediately after the start tag, then a runtime error occurs:
<Mutation mutation={UPSERT}> {mUpsert => (...

Error:

index.js:1446 Warning: Failed prop type: Invalid prop children of type array supplied to Mutation, expected function.
in Mutation (at SubmitCancel.js:82)

Versions

System:
OS: macOS High Sierra 10.13.6
Binaries:
Node: 10.12.0 - /usr/local/bin/node
npm: 6.5.0 - /usr/local/bin/npm
Browsers:
Chrome: 71.0.3578.98
Safari: 12.0.2
npmPackages:
apollo-boost: ^0.1.22 => 0.1.22
react-apollo: ^2.3.2 => 2.3.2

@JoviDeCroock
Copy link
Contributor

I don't think this has anything to do with apollo, because we are expecting a render function. This has to do with how react-jsx transpiles this. Because jsx now supports passing a function, array, null and a string.

@JeffML
Copy link
Author

JeffML commented Jan 17, 2019

Okay, but perhaps the error message could be better? In any case, I'll post this on react-jsx and see where it goes.

(BTW, not sure of the status of react-jsx; last update was quite some time ago.)

@JeffML JeffML closed this as completed Jan 17, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants