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

You can't open multiple lists at the same time. #14

Open
gbenavid opened this issue Sep 5, 2017 · 0 comments
Open

You can't open multiple lists at the same time. #14

gbenavid opened this issue Sep 5, 2017 · 0 comments

Comments

@gbenavid
Copy link
Owner

gbenavid commented Sep 5, 2017

Each time we press the button that triggers clicked() as seen in ShoppingList.js on line 26:

  render () {
    const { name, user, handleDelete, appendTo } = this.props;
    return ( 
      <article>
        <h3>{ name }</h3>
        <button onClick={ handleDelete }> Delete </button>
        <button onClick={()=> this.clicked(appendTo, name)}> Select </button>
        {
          this.state.childVisible ?
            <ShowItems  user={this.props.user} 
                        appendTo={appendTo}
                        content={this.props.content}
            />
          : <span></span>
        }
      </article>
    );
  }

The function toggles the show/hide state of the element.
And I'm not 100% sure of the toggleItems method.... let's look deeper into this...

  clicked(key, marketName){
    this.setState({childVisible: !this.state.childVisible}); /* We need to only toggle for the specific element with the same id as the item being clicked. */
    this.props.toggleItems(key, marketName);
    // this.setState({itemsToggled: !this.state.itemsToggled});
  }

The end functionality is a bug in the UI that manipulates the previous lists that are opened if multiple lists are selected.

@gbenavid gbenavid changed the title Only iterate through content if the item is not on the list. You can't open multiple lists at the same time. Sep 5, 2017
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

No branches or pull requests

1 participant