Manually setting the history in Chat Component

Hi @Alexander_Holman, hope you're doing well. I'm working on a product similar to yours as well, and I've been trying to manually set the chat history of the chat component. Have you found a way to do it with javascript? I tried doing it like this:

const messages = GetChatMessages.data;

// Loop through each message
for (let i = 0; i < messages.length; i++) {
console.log("Sending message: ", messages[i].message_content);
  // Submit each message to the chat component
  chat1.sendMessage({
    value: messages[i].message_content,
    sender: messages[i].sent_by
  });
console.log("Message added: ", messages[i].message_content);
}

I can see from the browser console:
Sending message: hi
Message added: hi

However, the message is not being added to the .data array of the chat component. I am not sure why, although there is no error at all.

Have you figured a way to do it?

Can anyone from the Retool team help? Help would be much appreciated : )