mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-19 07:32:11 +00:00
fix: actually wait for store to load before making requests
This commit is contained in:
parent
b73ee4a841
commit
51ed969702
4 changed files with 7 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ui",
|
||||
"version": "6.4.91",
|
||||
"version": "6.4.92",
|
||||
"license": "BUSL-1.1",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@9.15.5",
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export const storage = makeDefaultStorage({
|
|||
maxAge: 31 // The maximum age of the persisted data in days
|
||||
})
|
||||
|
||||
debug('Loading urql client')
|
||||
storagePromise.promise.finally(() => {
|
||||
debug('Graphcache storage initialized')
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,9 +1,14 @@
|
|||
import { redirect } from '@sveltejs/kit'
|
||||
|
||||
import { SETUP_VERSION } from '$lib'
|
||||
import { storagePromise } from '$lib/modules/anilist/urql-client'
|
||||
import { outdatedComponent } from '$lib/modules/update'
|
||||
|
||||
export async function load () {
|
||||
if (await outdatedComponent) return redirect(307, '/update/')
|
||||
|
||||
// hydrating the cache re-starts all queries, it's better to wait for cache to hydrate, than waste rate limit on requests which are dumped anyways
|
||||
// this was previously in anilist/client but it was a top level await, which isn't a great solution, this *should* be better?
|
||||
await storagePromise.promise
|
||||
redirect(307, Number(localStorage.getItem('setup-finished')) >= SETUP_VERSION ? '/app/home/' : '/setup')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { error, redirect } from '@sveltejs/kit'
|
|||
|
||||
import { dev } from '$app/environment'
|
||||
import { SETUP_VERSION } from '$lib'
|
||||
import { storagePromise } from '$lib/modules/anilist/urql-client'
|
||||
import native from '$lib/modules/native'
|
||||
import { outdatedComponent } from '$lib/modules/update'
|
||||
|
||||
|
|
@ -11,8 +10,4 @@ export async function load () {
|
|||
if (Number(localStorage.getItem('setup-finished')) < SETUP_VERSION) redirect(307, '/setup')
|
||||
|
||||
if (await outdatedComponent) redirect(307, '/update/')
|
||||
|
||||
// hydrating the cache re-starts all queries, it's better to wait for cache to hydrate, than waste rate limit on requests which are dumped anyways
|
||||
// this was previously in anilist/client but it was a top level await, which isn't a great solution, this *should* be better?
|
||||
await storagePromise.promise
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue