refactor(frontend): 非ログイン画面でのmeta取得を減らす (#13776)
* refactor(frontend): 非ログイン画面でのmeta取得を減らす * fix(frontend): サーバー供給のmetaとクライアントフォールバックで取れるmetaの型が違うのを修正 * force fetch meta at welcome.vue * refactor
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user