diff options
| author | かっこかり <67428053+kakkokari-gtyih@users.noreply.github.com> | 2024-05-01 13:51:00 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-01 13:51:00 +0900 |
| commit | 2017f9114fe281ac86304f3e7956589f43d9ccce (patch) | |
| tree | 83794780d60ff41ccfcb95d59d642ae6b699d071 /packages/frontend/src/instance.ts | |
| parent | fix(backend): add detailed schema to `fetch-rss` endpoint (#13764) (diff) | |
| download | sharkey-2017f9114fe281ac86304f3e7956589f43d9ccce.tar.gz sharkey-2017f9114fe281ac86304f3e7956589f43d9ccce.tar.bz2 sharkey-2017f9114fe281ac86304f3e7956589f43d9ccce.zip | |
refactor(frontend): 非ログイン画面でのmeta取得を減らす (#13776)
* refactor(frontend): 非ログイン画面でのmeta取得を減らす
* fix(frontend): サーバー供給のmetaとクライアントフォールバックで取れるmetaの型が違うのを修正
* force fetch meta at welcome.vue
* refactor
Diffstat (limited to 'packages/frontend/src/instance.ts')
| -rw-r--r-- | packages/frontend/src/instance.ts | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/frontend/src/instance.ts b/packages/frontend/src/instance.ts index 22337e7eb9..7df6ec205c 100644 --- a/packages/frontend/src/instance.ts +++ b/packages/frontend/src/instance.ts @@ -28,7 +28,7 @@ if (providedAt > cachedAt) { // TODO: instanceをリアクティブにするかは再考の余地あり -export const instance: Misskey.entities.MetaResponse = reactive(cachedMeta ?? {}); +export const instance: Misskey.entities.MetaDetailed = reactive(cachedMeta ?? {}); export const serverErrorImageUrl = computed(() => instance.serverErrorImageUrl ?? DEFAULT_SERVER_ERROR_IMAGE_URL); @@ -38,7 +38,7 @@ export const notFoundImageUrl = computed(() => instance.notFoundImageUrl ?? DEFA export const isEnabledUrlPreview = computed(() => instance.enableUrlPreview ?? true); -export async function fetchInstance(force = false): Promise<void> { +export async function fetchInstance(force = false): Promise<Misskey.entities.MetaDetailed> { if (!force) { const cachedAt = miLocalStorage.getItem('instanceCachedAt') ? parseInt(miLocalStorage.getItem('instanceCachedAt')!) : 0; @@ -48,7 +48,7 @@ export async function fetchInstance(force = false): Promise<void> { } const meta = await misskeyApi('meta', { - detail: false, + detail: true, }); for (const [k, v] of Object.entries(meta)) { @@ -57,4 +57,6 @@ export async function fetchInstance(force = false): Promise<void> { miLocalStorage.setItem('instance', JSON.stringify(instance)); miLocalStorage.setItem('instanceCachedAt', Date.now().toString()); + + return instance; } |