1
<td v-if="currentId != loop.id" class="text-center">
    <div :set="currentId = loop.id">{{ loop.id }}</div>
</td>
<td v-else></td>

need to achieve this its a multidimensional Parent/Child array, need to print on a table. so when first parent is printed on a row, until its child is finished, we will stop printing repetitive parent. console warning I have set currentId as loop.id, it is showing console warning.

Niraj
  • 11
  • 6
  • Your logic seems alright. We don't have enough code/information to help you further. – Wimanicesir Jan 31 '23 at 13:37
  • although I am not sure but I think currentId is updated each time may be it is global variable, let or const in defining variable may help – gp el Jan 31 '23 at 14:11
  • 1
    `:set="currentId = loop.id"` is definitely causing the issue. `currentId` is being assigned on render, causing the `v-if` to recalculate, rerendering the component, causing `currentId` to be assigned again, repeating forever until forcibly stopped by the browser... what even is the goal of this line of code? it doesn't really make sense to do in the first place – yoduh Jan 31 '23 at 15:59

1 Answers1

0
data() {
  return {
    currentId: '0',
  }
},
methods: {
  assignCurrentId: function(id) {
    if( this.currentId == id) {
        return false;
    } else{
        Object.defineProperty(this, 'currentId', {value: id, writeable: false});
        return true;
    }
}

found something here, to stop/disable reactivity on variables, it is working now - https://stackoverflow.com/a/52844620/5156910

Niraj
  • 11
  • 6
  • your question is not about reactivity at all, Its about the formatting/displaying the parent child relationship data in user interface. If you can just add the response data, I can help you in building that table structure. – Debug Diva Feb 01 '23 at 06:43
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 02 '23 at 12:29