[Solved] Messages rules V2

Hello. I try to use tailMessageRule but it works strange, “message-tail” class is added to the element before the sought-for one. And after all elements have been processed, this function is called one more time with undefined parameters. Here is my code

var chat = app.messages.create({
    el: "#chat .messages",
    tailMessageRule: function (message, previousMessage, nextMessage) {
        if (!message || message.isTitle) return false;
        if (!nextMessage || nextMessage.type !== message.type || nextMessage.name !== message.name) return true;
        return false;
    }
});

Do you have a link to live example or JSFiddle with the issue?

Unfortunately all attempts to reproduce this error on JSFiddle have failed. It appears when data is loaded with app.request.json, JSFiddle ajax emulation gives correct results

I solved it. The problem was in adding date title with append instead addMessage.