Hi Pierre,
I can confirm the race case situation. I'll bring it up with the shiny team later today.
I was able to get around the event race case by wrapping the console.log and sparkline calculations in a setTimeout(update, 0)
.
$(function() {
// trigger redraw of sparklines after each event value
$(document).on({
'shiny:value': function(event) {
if (event.name === 'tbl') {
// defer to next tick to add sparklines
setTimeout(function() {
console.log($('.spkln').length);
$('.spkln').sparkline('html', {type: 'bar', barColor: 'red'});
}, 0)
}
}
});
});
Hope this helps!
Best,
Barret