mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-11 03:24:16 +00:00
improve initialization crash process
This commit is contained in:
parent
f398358afc
commit
30aadbd5d6
@ -161,13 +161,14 @@ class App extends React.Component {
|
|||||||
|
|
||||||
this.wsReconnectingTry = this.wsReconnectingTry + 1
|
this.wsReconnectingTry = this.wsReconnectingTry + 1
|
||||||
|
|
||||||
if (this.wsReconnectingTry > 3) {
|
if (this.wsReconnectingTry > 3 && app.settings.get("app.reloadOnWSConnectionError")) {
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"websocket_latency_too_high": function () {
|
"websocket_latency_too_high": function () {
|
||||||
if (!this.latencyWarning) {
|
if (!this.latencyWarning) {
|
||||||
this.latencyWarning = true
|
this.latencyWarning = true
|
||||||
|
|
||||||
Toast.show({
|
Toast.show({
|
||||||
icon: "loading",
|
icon: "loading",
|
||||||
content: "Slow connection...",
|
content: "Slow connection...",
|
||||||
@ -178,6 +179,7 @@ class App extends React.Component {
|
|||||||
"websocket_latency_normal": function () {
|
"websocket_latency_normal": function () {
|
||||||
if (this.latencyWarning) {
|
if (this.latencyWarning) {
|
||||||
this.latencyWarning = null
|
this.latencyWarning = null
|
||||||
|
|
||||||
Toast.show({
|
Toast.show({
|
||||||
icon: "success",
|
icon: "success",
|
||||||
content: "Connection restored",
|
content: "Connection restored",
|
||||||
@ -243,7 +245,7 @@ class App extends React.Component {
|
|||||||
RenderError: (props) => {
|
RenderError: (props) => {
|
||||||
return <RenderError {...props} />
|
return <RenderError {...props} />
|
||||||
},
|
},
|
||||||
Crash: Crash,
|
Crash: Crash.CrashWrapper,
|
||||||
initialization: () => {
|
initialization: () => {
|
||||||
return <div className="splash_wrapper">
|
return <div className="splash_wrapper">
|
||||||
<div className="splash_logo">
|
<div className="splash_logo">
|
||||||
@ -300,11 +302,11 @@ class App extends React.Component {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
this.eventBus.emit("render_initialization")
|
this.eventBus.emit("app.render_initialization")
|
||||||
|
|
||||||
await this.initialization()
|
await this.initialization()
|
||||||
|
|
||||||
this.eventBus.emit("render_initialization_done")
|
this.eventBus.emit("app.render_initialization_done")
|
||||||
}
|
}
|
||||||
|
|
||||||
initialization = async () => {
|
initialization = async () => {
|
||||||
@ -371,7 +373,7 @@ class App extends React.Component {
|
|||||||
|
|
||||||
await Promise.tasked(initializationTasks).catch((reason) => {
|
await Promise.tasked(initializationTasks).catch((reason) => {
|
||||||
console.error(`[App] Initialization failed: ${reason.cause}`)
|
console.error(`[App] Initialization failed: ${reason.cause}`)
|
||||||
window.app.eventBus.emit("appLoadError", reason.cause, reason.details)
|
app.eventBus.emit("app.crash", reason)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user