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

Proposal: componentMethods option - unintuitive behavior #69

Open
vemv opened this issue Feb 11, 2018 · 2 comments
Open

Proposal: componentMethods option - unintuitive behavior #69

vemv opened this issue Feb 11, 2018 · 2 comments
Labels
v2 Available in v2

Comments

@vemv
Copy link

vemv commented Feb 11, 2018

Hi again!

I tried setting "componentMethods": ["render"], in my .ccarc.

This results in the following:

class template extends Component {
    constructor(props) {
        super(props)
    }
    
    render(){}

    render() {
        return (
            <div className="template"></div>
        );
    }
}

I see two issues here:

  • duplicate render method
  • I didn't specify constructor. Intuition would tell me that for a ["render"] option, that method shouldn't be emitted. It could be emitted for [] (i.e. by default), and for ["constructor", "shouldComponentUpdate"] (i.e. if explicitly specified).

Cheers - Victor

@CVarisco
Copy link
Owner

Hi @vemv

Before all, thanks for your support and alert 👍

Anyway, the componentMethods as you can see isn't exclusive and add extra methods to the component (and doesn't check if exist or not one method inside the list).
For now, I can propose a PR where I can change the documentation that explicit these.
And for the future, we can think which is the best behaviour for that option.

What do you think? 😃

@CVarisco CVarisco self-assigned this Feb 26, 2018
@CVarisco
Copy link
Owner

CVarisco commented Mar 9, 2018

Currently, I'm working on the v2 and I can consider changing that option to accept every method to include in the components.
Thank you for your proposal and help 👍

@CVarisco CVarisco changed the title componentMethods option - unintuitive behavior Proposal: componentMethods option - unintuitive behavior Mar 9, 2018
@CVarisco CVarisco removed their assignment Mar 9, 2018
@CVarisco CVarisco added the v2 Available in v2 label May 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 Available in v2
Projects
None yet
Development

No branches or pull requests

2 participants