NolanN
Building a complex countdown table column
The
countdown-column.blade.php
that I just uploaded is stripped down from what it need to be in its final state. It should ultimately be using the countdown store to trigger an update of the countdown every second but I pulled some of that out to try to figure out what is going on29 replies
Building a complex countdown table column
Trying to simplify this to narrow down the issue...
After changing to the following code, I see that
init()
is still running when the table polls and finds new data for the true_ends_at
column. I can also verify that remaining
is changing but the display does not update until the following poll before it updates.
So at the moment the sequence is like this:
- true_ends_at changes
- table polls and new data is printed to console but display does not update
- table polls again and there is NOT new data but the display updates with the new data from the previous poll
29 replies
Building a complex countdown table column
Yeah, it seems that the key would have to match a property in
x-data
. This watch is not being triggered however, even though the state is changing. I think this is because when the table polls, Alpine is reinitialized. If I add console.log('init')
to the beginning of the method, I do see that when the table polls and finds new data
29 replies
Building a complex countdown table column
Ok, I think I see where you are going but I want to clarify a few things. I'm not using
x-init
so I'll put it in init()
instead. Shouldn't this be $watch('endTime', value => ....)
instead of $watch('{{ $getState()->toISOString() }}', value => ....)
?29 replies