mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-04 19:34:35 -05:00
Fix/gql about webui query same response type as webui update info (#781)
* Use a new type for the webui about info query Using the same type for this and the webui update queries/mutations caused apollo to save it as the same data in the cache, overwriting the "about info" * Use a new type for the webui about check query To prevent similar issues (cc3bf5f34a8afebadd306d037db1a10088ef9334) with the "update check" and the "update progress" payloads * Throw update check error when calling it via the query Otherwise, the error is never raised to the frontend * Set "ERROR" state in case the update check failed on WebUI update trigger
This commit is contained in:
@@ -3,6 +3,7 @@ package suwayomi.tachidesk.graphql.mutations
|
||||
import kotlinx.coroutines.flow.first
|
||||
import kotlinx.coroutines.withTimeout
|
||||
import suwayomi.tachidesk.graphql.types.UpdateState.DOWNLOADING
|
||||
import suwayomi.tachidesk.graphql.types.UpdateState.ERROR
|
||||
import suwayomi.tachidesk.graphql.types.UpdateState.STOPPED
|
||||
import suwayomi.tachidesk.graphql.types.WebUIUpdateInfo
|
||||
import suwayomi.tachidesk.graphql.types.WebUIUpdateStatus
|
||||
@@ -32,6 +33,8 @@ class InfoMutation {
|
||||
val (version, updateAvailable) = WebInterfaceManager.isUpdateAvailable()
|
||||
|
||||
if (!updateAvailable) {
|
||||
val didUpdateCheckFail = version.isEmpty()
|
||||
|
||||
return@withTimeout WebUIUpdatePayload(
|
||||
input.clientMutationId,
|
||||
WebUIUpdateStatus(
|
||||
@@ -41,7 +44,7 @@ class InfoMutation {
|
||||
tag = version,
|
||||
updateAvailable,
|
||||
),
|
||||
state = STOPPED,
|
||||
state = if (didUpdateCheckFail) ERROR else STOPPED,
|
||||
progress = 0,
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user