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

Extract to component bug in generated code #62

Closed
KatSick opened this issue Mar 13, 2019 · 4 comments
Closed

Extract to component bug in generated code #62

KatSick opened this issue Mar 13, 2019 · 4 comments
Labels

Comments

@KatSick
Copy link

KatSick commented Mar 13, 2019

Given input

    <FlatList
        data={collapsedData}
        keyExtractor={item => `${item._eprId}_${item._eprValue}`}
        renderItem={this.makeRenderItem(data)}
        ListHeaderComponent={this.renderHeader}
        ListEmptyComponent={this.renderEmpty}
        onRefresh={this.props.onRefresh}
        refreshing={this.props.refreshing}
      />

Extracted generated (Table named) component

export function Table({
  collapsedData,
  item,
  data,
  _eprId,
  _eprValue,
  makeRenderItem,
  renderHeader,
  renderEmpty,
  onRefresh,
  refreshing
}) {
  return (
    <FlatList
      data={collapsedData}
      keyExtractor={item => `${_eprId}_${_eprValue}`}
      renderItem={makeRenderItem(data)}
      ListHeaderComponent={renderHeader}
      ListEmptyComponent={renderEmpty}
      onRefresh={onRefresh}
      refreshing={refreshing}
    />
  );
}

As you can see keyExtractor is generated incorrectly

@borislit
Copy link
Contributor

@KatSick Thanks for your reporting! ill try getting to this in the coming few days, although PRs are super welcome. Id love to point You in the right direction

@KatSick
Copy link
Author

KatSick commented Mar 14, 2019

@borislit sounds interesting todo...

@borislit
Copy link
Contributor

@KatSick I found the problem. I hope to have the fix out in coming day or two

borislit pushed a commit that referenced this issue Mar 26, 2019
# [4.10.0](v4.9.0...v4.10.0) (2019-03-26)

### Bug Fixes

* **class-to-functional:** useState hook not added for state variables not inited or set ([32c71f6](32c71f6))
* **extract-component:** incorrect handling of nested member expressions. Fixes [#62](#62) ([1840c64](1840c64))

### Features

* **extract-component:** added extraction to the same file ([63911e7](63911e7))
@borislit
Copy link
Contributor

🎉 This issue has been resolved in version 4.10.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants