yield: show={expr} has different scope than if={expr} #2158

Closed
juodumas opened this Issue Dec 14, 2016 · 6 comments

Projects

None yet

4 participants

@juodumas
Contributor
  1. Describe your issue:
    Expression in show={expression} has different scope than if={expression}, onclick={expression} etc. inside <yield>. Looks like the problems was introduced in riot-3.0.3 while fixing riot/riot#2125.

  2. Can you reproduce the issue?
    http://plnkr.co/edit/Z6c36rPdnhplBVNN6JQ0?p=preview

  3. On which browser/OS does the issue appear?
    Chromium 54

  4. Which version of Riot does it affect?
    riot@v3.0.4

  5. How would you tag this issue?

  • Bug
@juodumas juodumas referenced this issue in riot/compiler Dec 14, 2016
Closed

yield: show={expr} has different scope than if={expr} #99

1 of 1 task complete
@TimWillis

This one is getting me as well on Riot 3.0.4 - just switched to riot 3.0 and started updating everything, then jumped to 3.0.4 to hopefully help fix the bugs I got from going to 2 to 3 and now more bugs with this issue...

@GianlucaGuarini
Member

@riot/collaborators the current yield behavior should be fixed I would like to put it on the top of our priority list together with performance improvements. Thanks @juodumas for reporting this issue

@TimWillis

On line 1135 in riotjs I did this:

// the value for the toggle must consider also the parent tag
//   value = isToggle ? tmpl(expr.expr, extend({}, this, this.parent)) : tmpl(expr.expr, this),
  value = tmpl(expr.expr, this),

I believe someone put this in to fix an issue, but I am not having that issue that I can find, and this fixed the issue here. Hope this helps solve the problem for the next release.

@ashleybrener
Contributor
ashleybrener commented Dec 29, 2016 edited

@TimWillis I did same as you, this issue has been vexing me last few days

@ashleybrener
Contributor

Here's the original commit 9e024dd#diff-d54b456d54b337c5989fdf67462089ae

@GianlucaGuarini what was the reason here for the show directive also evaluating the parent? Seems to cause some complications, removing this would also eliminate the need for my PR patch #2186

@ashleybrener ashleybrener added a commit to frisb/riot that referenced this issue Dec 30, 2016
@ashleybrener ashleybrener Remove evaluation of parent on the show directive and need to enumera…
…te tag instance property descriptors. Fixes riot/riot#2158
25ce058
@GianlucaGuarini
Member

Fixed in riot@3.0.6 now the show, hide if directives behave always consistently on any context

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