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

Dev Tools UI: Bad readability of props of type function #17781

Closed
Aarbel opened this issue Jan 5, 2020 · 5 comments · Fixed by #17789
Closed

Dev Tools UI: Bad readability of props of type function #17781

Aarbel opened this issue Jan 5, 2020 · 5 comments · Fixed by #17789

Comments

@Aarbel
Copy link

Aarbel commented Jan 5, 2020

Dev Tools evolved a lot the last months.

Last version doesn't display well functions in props, it leaves an empty field so hard to see if the prop is really passed and if there's really and function passes in the props of the component.

For example i dont' know if the prop onChange really exists as a prop of the component TokenInput.
Don't know also which props are undefined.

Could be also great to use the propTypes to show the types of the props.

image

image

@bvaughn
Copy link
Contributor

bvaughn commented Jan 5, 2020

Can you share the code (not a picture of partial code, but actual runnable code) that reproduces the empty function names like onAdd, onChange, onRemove in your screenshot? Chrome usually does a pretty good job of assigning functions names, and DevTools just displays the name that's assigned by a browser.

@Aarbel
Copy link
Author

Aarbel commented Jan 6, 2020

class LabelsInput extends React.Component {

    onCompletionClick = (completion) => {
        console.log('HELLO')
    }

    onChange = (event) => {
        console.log('HELLO')
    }

    onTokenRemove = (token) => {
        console.log('HELLO')
    }

    onTokenCreationAndAdd = (completion, color) => {
        console.log('HELLO')
    }

    onEditAll = () => {
        console.log('>>> WOHOO onEdit');
    }

    render() {
        const { query } = this.state;
        const { placeholder, labels } = this.props;

        const tokenName = 'Créer le tag';
        const onEditAllText = 'Éditer les tags';

        return ( 
            <TokenInput 
                text={query}
                tokens= {this.tokens}
                completions={this.completions}
                placeholder={placeholder}
                onChange={this.onChange}
                onAdd={this.onCompletionClick}
                onRemove={this.onTokenRemove}
                tokenName={tokenName}
                handlesColor={true}
                onTokenCreationAndAdd={this.onTokenCreationAndAdd}
                onEditAll={this.onEditAll.bind(this)}
                onEditAllText={onEditAllText}
            />
        );
    }
}

@bvaughn
Copy link
Contributor

bvaughn commented Jan 6, 2020

More succinct, runnable repro:
https://codesandbox.io/s/mystifying-chaplygin-mbmtp

@bvaughn
Copy link
Contributor

bvaughn commented Jan 6, 2020

Fixed via #17789

Will go out with the next release, probably sometime this week

Before

Screen Shot 2020-01-06 at 9 13 29 AM

After

Screen Shot 2020-01-06 at 9 02 43 AM

@Aarbel
Copy link
Author

Aarbel commented Jan 7, 2020

Wow very fast, thanks a lot @bvaughn

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

Successfully merging a pull request may close this issue.

2 participants