question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `id` to error entries for iteration

See original GitHub issue

It is considered the best practice in Vue.js to define key for v-for iterations for performance and determinism reasons. And it is not uncommon to use vuelidate results this way:

  <div class="input-errors" v-for="error of state.v$.classifierId.$errors" v-bind:key="error ">
    <div class="error-msg">{{ error.$message }}</div>
  </div>

However, currently there is no unique id exposed on error array that could be used for v-bind: key, and generic error has to be used, which is against the Vue.js recommendation.

To Reproduce Perform any validation that results in errors.

Expected behavior There is a unique id field per entry in $errors array.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
dobromir-hristovcommented, Apr 17, 2021

PR is up, @shentao will review when he gets some time and we can release it 😃

0reactions
kibertoadcommented, Apr 16, 2021

Yup, that would definitely work!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add id to array of objects - Stack Overflow
You can use the map() function to iterate over your array of objects. n is each of your objects and you can set...
Read more >
for...of - JavaScript | MDN - MDN Web Docs
A for...of loop exits when the iterator has completed (the iterator's next() method returns an object containing done: true ). You may also...
Read more >
Iterate Through an Object's Keys and Values in JavaScript or ...
entries method. This tutorial walks you through each of these loops to iterate through an object's keys and values. Node.js Series Overview.
Read more >
Iterating over jQuery and non-jQuery Objects
Iterating over jQuery and non-jQuery Objects. jQuery provides an object iterator utility called $.each() as well as a jQuery collection iterator ...
Read more >
Define iteration paths (sprints) and configure team iterations
Learn how to define the iteration and sprint fields when you assign work items and configure dashboards in Azure DevOps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found