// 1 ms timeout to avoid react breaking when re-rendering
setTimeout(()=>{
if(!shouldAttemptRecover){
try{
showNotification({
color:"#eed202",
title:"Discord has crashed!",
body:"Awn :( Discord has crashed two times rapidly, not attempting to recover.",
noPersist: true,
});
}catch{}
return;
}
shouldAttemptNextHandle=false;
shouldAttemptRecover=false;
// This is enough to avoid a crash loop
setTimeout(()=>shouldAttemptRecover=true,500);
if(++crashCount>5){
try{
showNotification({
color:"#eed202",
title:"Discord has crashed!",
body:"Awn :( Discord has crashed more than five times, not attempting to recover.",
noPersist: true,
});
}catch{}
lastCrashTimestamp=Date.now();
returnfalse;
}
setTimeout(()=>crashCount--,60_000);
try{
if(crashCount===1)maybePromptToUpdate("Uh oh, Discord has just crashed... but good news, there is a Vencord update available that might fix this issue! Would you like to update now?",true);
if(settings.store.attemptToPreventCrashes){
this.handlePreventCrash(_this);
returntrue;
if(!hasCrashedOnce){
hasCrashedOnce=true;
maybePromptToUpdate("Uh oh, Discord has just crashed... but good news, there is a Vencord update available that might fix this issue! Would you like to update now?",true);
}
if(settings.store.attemptToPreventCrashes){
this.handlePreventCrash(_this);
}
}catch(err){
CrashHandlerLogger.error("Failed to handle crash",err);
}
returnfalse;
}catch(err){
CrashHandlerLogger.error("Failed to handle crash",err);