R Plotly bug: trace is lost with animation and not all ids exist in first frame

This issue arises when I have animated frames and the ids do not exist for all frames (particularly the first one). Here is a reproducible example:

dat = data.frame(f = rep(1:4, each = 10), 
             x = rep(1:5, 2*4), 
             y = rep(c(rep(1, 5), rep(2, 5)), 4), 
             id = rep(rep(LETTERS[1:2], each = 5), 4))
dat = dat[dat$id == "B" | dat$id == "A" & dat$f == 3,]
plot_ly(x = ~ x, 
    y = ~ y,colors = c("#FF0000","#0000FF")) %>%
  add_lines(
    data = group_by(dat, id, f),
    frame = ~ f,
    key = ~ id,
    ids = ~ id,
    color = ~ id)

Notice in frame 3 that the line at y = 2 disappears. I also get a warning:

 Warning message:
 In p$x$data[firstFrame] <- p$x$frames[[1]]$data :
   number of items to replace is not a multiple of replacement length

@stephen.l.jones Did you ever find a fix for this? I am running into the same thing. Thanks in advance!

I filed an issue here a few month ago.