Fixed race condition where the chat update function could not be used

This commit is contained in:
Bofh 2020-12-30 15:43:59 +01:00
parent 7649f30323
commit 58c4049d09
1 changed files with 9 additions and 2 deletions

View File

@ -50,8 +50,15 @@ async function updateStatusAndThread (instanceName, accessToken, timelineName, s
addStatusesOrNotifications(instanceName, timelineName, concat(context.ancestors, context.descendants))
}
if (window.fediloveFunctions !== undefined)
if (typeof window !== "undefined") {
const _this = setInterval(function() {
if (window.fediloveFunctions != undefined) {
window.fediloveFunctions.updateStatusAndThread = updateStatusAndThread;
clearInterval(_this);
}
}, 300);
}
async function fetchFreshThreadFromNetwork (instanceName, accessToken, statusId) {
const [status, context] = await Promise.all([