Skip to content

0.11.5 breaks repeat using $data #707

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

Closed
benceg opened this issue Feb 9, 2015 · 5 comments
Closed

0.11.5 breaks repeat using $data #707

benceg opened this issue Feb 9, 2015 · 5 comments

Comments

@benceg
Copy link

benceg commented Feb 9, 2015

I'm writing an application that needs to list arbitrary values in a JSON object two levels deep. Some of these values are arrays whose constituent objects contain id and value properties.

Consider the following code:

...
data : function() {
  return {
    model : {
      "arbitrary_key" : [
        { "id" : "1", "value" : "arbitrary value 1" },
        { "id" : "2", "value" : "arbitrary value 2" },
        { "id" : "3", "value" : "arbitrary value 3" },
        { "id" : "4", "value" : "arbitrary value 4" }
      ]
    }
  }
}
...
<li v-repeat="model">

  {{ $key }}

  <ul>
    <li v-repeat="$data">
      <label>{{ id }}</label>
      <var>{{ value }}</var>
    </li>
  </ul>

</li>

The code above outputs the list of four items as expected using Vue 0.11.4, but outputs nothing when using Vue 0.11.5. I don't believe there is a test case to cover this particular use case.

@multimeric
Copy link

Can you show me a JSFiddle that shows this behaviour? I copied your code and changed it from a component to a base Vue instance and it's completely skipping the v-repeat=$data

http://jsfiddle.net/o9j3yjcq/

@calebboyd
Copy link

I think thats the point. You can change to 0.11.4 and it renders as expected. Something to do with:
yyx990803/vue@ab254f7

@benceg
Copy link
Author

benceg commented Feb 10, 2015

Apologies, @TMiguelT, my post was unnecessarily ambiguous! I skipped the bit where my template spews out $value if $data | empty (a custom filter) returns true.

So expected behaviour was actually to see nothing; but in my case it was displaying $value - a stringified array of objects. I've updated the OP to avert any possible confusion for anyone else who might have caught the same issue.

Thank you so much for the fix @calebboyd.

yyx990803 added a commit that referenced this issue Feb 10, 2015
fix #707: v-repeat nested repeats on object
@yyx990803
Copy link
Member

Fixed by merging #709.

@benceg
Copy link
Author

benceg commented Feb 10, 2015

Thanks Evan. 😃

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

4 participants