@techee commented on this pull request.
/* we need to re-convert iter->filter_iter as the original filter_iter
+ * becomes invalid after removal and re-addition of doc from/to sidebar */
The root reason is that iter itself changed (which might not be clear here, as it's a pointer to a member of doc, and is not directly modified here)
Right, I was wondering if `iter` remained the same and didn't notice the pointer to `doc`. I should probably update the comment.