Calculation of variables does not show actual value immediately
ssssadsadasd
13 days ago
Jan 1, 2025, 6:44 PM
I have a reusable. The reusable has an attribute item = { "created_at": "2025-01-01T17:56:04.15182+00:00"} The reusable has a variable milliseconds = now - item.created_at (which translates in milliseconds). I use this variable because I do not want to calculate it for each if condition. The reusable has a text which translates to different time format: so if created_at is less than one minute = just now, less than 1 hour = x minutes etc. Suppose created_at is less than one hour. It should show immediately xm(inutes) but it first shows the last item of the if condition and then correctly shows xm(inutes). [see video](https://vimeo.com/1043286016/a2cc66cd60?ts=0&share=copy) why does this happen? here is the [test url](https://toddle.dev/projects/turquoise_o_en_lars_permanent_chicken/branches/start/components/test?leftpanel=design&canvas-width=800&canvas-height=800&rightpanel=attributes). P.S.: make sure to change the value in the page to a date less than 1 hour prior
β 1
Lucas G
13 days ago
Jan 1, 2025, 6:51 PM
Your video seems like the browser is being sluggish. Not sure if this is a local issue more than a toddle issue
It doesn't behave like that on my end
needtheanswers
13 days ago
Jan 1, 2025, 6:53 PM
Did you try using a formula instead? Formulas should update instantly
π1
ssssadsadasd
13 days ago
Jan 1, 2025, 6:53 PM
@Lucas G is it supposed to behave like that anyway? so if the first condition is true, then why does it show the value of the last condition which it is not supposed to achieve?
Lucas G
13 days ago
Jan 1, 2025, 6:54 PM
It's not about the formula itself. The variable is not being set right away
π1
ssssadsadasd
13 days ago
Jan 1, 2025, 6:55 PM
yeah, I understand
Lucas G
13 days ago
Jan 1, 2025, 6:55 PM
Basically the variable isn't set so the formula runs through, then the variable sets and it updates.