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

Function passed as undefined when on a tag with an `each` loop #2474

Kangaroux opened this Issue Oct 27, 2017 · 0 comments


None yet
2 participants

Kangaroux commented Oct 27, 2017

  1. Describe your issue:

A child tag that is defined using each to create multiple tags will not properly pass functions through as an opt. A workaround is to wrap the child tag in a virtual, and put the each on the virtual tag instead.

  1. Can you reproduce the issue?

  <h2>Clicked { clicked } times</h2>
  <p>Wrapped in a virtual tag:</p>
  <virtual each={ stuff }>
    <child-tag func-click={ clickBtn } />
  <p>No virtual tag:</p>
  <child-tag each={ stuff } func-click={ clickBtn } />

    this.clicked = 0;
    this.stuff = [0,0,0,0,0];
    clickBtn() {
        clicked: this.clicked + 1

  <button onclick={ opts.funcClick }>
    { typeof opts.funcClick }
  1. On which browser/OS does the issue appear?

Firefox 56 win10

  1. Which version of Riot does it affect?

Riot 3.7.3

  1. How would you tag this issue?
  • Question
  • Bug
  • Discussion
  • Feature request
  • Tip
  • Enhancement
  • Performance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment