Upon using Vue, I encountered a warning message:
You may have an infinite update loop in a component render function
Although I attempted to resolve the issue by switching from methods to computed properties, the warning persisted. Everything seems to be functioning correctly without any loops, but Vue continues to display the warning.
.battle__invite(v-for='(invite, index) in invites', :key='index')
battle__result.battle__result--finished(
:class='getResultClass(invite.challengerScore, invite.challengedScore)'
) {{ challengeResult }}
Computed:
getResultClass() {
return (challengerScore, challengedScore) => {
if (challengerScore > challengedScore) {
this.challengeResult = 'win'
return 'win'
} else if (challengerScore < challengedScore) {
this.challengeResult = 'defeat'
return 'defeat'
} else {
this.challengeResult = 'draw'
return 'draw'
}
}
},