Open
Description
In the course video (but not the text below), the salePrice
effect is declared after the total
effect. This causes an infinite loop.
(Example of order in video)
effect(() => {
total = salePrice.value * product.quantity
})
effect(() => {
salePrice.value = product.price * 0.9
})
I added a check in the ref function to not set the value if it had not changed, which solved it for me:
set value(newVal) {
if (newVal !== raw) {
raw = newVal
trigger(r, 'value')
}
}
But then I came here to investigate and I noticed the difference, so I thought I'd point it out.
Metadata
Metadata
Assignees
Labels
No labels