fetchWidgetData script goes into a loop and spams with requests

script launch with transfer of user authorization data is implemented.

The problem occurs when the widget is connected with a specific user (token + mail) and the page reloads. At that point, requests start pouring in until the stack is full. After that the widget is reloaded and everything is normal.

When reloading, two methods are called to clear the chat after user change:

window.HubSpotConversations.clear({ resetWidget: true });
window.HubSpotConversations.widget.load();


@ASchadnev wrote:

script launch with transfer of user authorization data is implemented.

The problem occurs when the widget is connected with a specific user (token + mail) and the page reloads. At that point, requests start pouring in until the stack is full. After that the widget is reloaded and everything is normal.

When reloading, two methods are called to clear the chat after user change:

window.HubSpotConversations.clear({ resetWidget: true });
window.HubSpotConversations.widget.load();


To address this problem, two methods are called to clear the chat after a user change:
window.HubSpotConversations.clear({ resetWidget: true });
window.HubSpotConversations.widget.load();

These methods aim to reset the widget and clear any existing chat data. However, it appears that they may not be functioning as expected, leading to the continuous loop of requests. To troubleshoot, ensure that these methods are correctly implemented and called at the appropriate times, such as before the widget is reloaded. Additionally, consider checking for any potential conflicts or issues with other scripts or components on the page that could be affecting the behavior of the widget. Debugging and testing these methods thoroughly can help identify and resolve the root cause of the loop and spamming of requests.