refactor(frontend): 非推奨となったReactivity Transformを使わないように (#12539)

* refactor(frontend): 非推奨となったReactivity Transformを使わないように

* refactor: 不要な括弧を除去

* fix: 不要なアノテーションを除去

* fix: Refの配列をrefしている部分の対応

* refactor: 不要な括弧を除去

* fix: lint

* refactor: Ref、ShallowRef、ComputedRefの変数の宣言をletからconstに置換

* fix: type error

* chore: drop reactivity transform from eslint configuration

* refactor: remove unnecessary import

* fix: 対応漏れ
This commit is contained in:
zyoshoka
2023-12-07 14:42:09 +09:00
committed by GitHub
parent e42c91dee7
commit 406b4bdbe7
277 changed files with 3353 additions and 3441 deletions

View File

@@ -27,7 +27,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template>
<script lang="ts" setup>
import { defineAsyncComponent, computed, watch } from 'vue';
import { defineAsyncComponent, computed, watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import { acct as getAcct } from '@/filters/user.js';
import * as os from '@/os.js';
@@ -54,17 +54,17 @@ const props = withDefaults(defineProps<{
page: 'home',
});
let tab = $ref(props.page);
let user = $ref<null | Misskey.entities.UserDetailed>(null);
let error = $ref(null);
const tab = ref(props.page);
const user = ref<null | Misskey.entities.UserDetailed>(null);
const error = ref(null);
function fetchUser(): void {
if (props.acct == null) return;
user = null;
user.value = null;
os.api('users/show', Misskey.acct.parse(props.acct)).then(u => {
user = u;
user.value = u;
}).catch(err => {
error = err;
error.value = err;
});
}
@@ -72,9 +72,9 @@ watch(() => props.acct, fetchUser, {
immediate: true,
});
const headerActions = $computed(() => []);
const headerActions = computed(() => []);
const headerTabs = $computed(() => user ? [{
const headerTabs = computed(() => user.value ? [{
key: 'home',
title: i18n.ts.overview,
icon: 'ti ti-home',
@@ -86,11 +86,11 @@ const headerTabs = $computed(() => user ? [{
key: 'activity',
title: i18n.ts.activity,
icon: 'ti ti-chart-line',
}, ...(user.host == null ? [{
}, ...(user.value.host == null ? [{
key: 'achievements',
title: i18n.ts.achievements,
icon: 'ti ti-medal',
}] : []), ...($i && ($i.id === user.id)) || user.publicReactions ? [{
}] : []), ...($i && ($i.id === user.value.id)) || user.value.publicReactions ? [{
key: 'reactions',
title: i18n.ts.reaction,
icon: 'ti ti-mood-happy',
@@ -120,15 +120,15 @@ const headerTabs = $computed(() => user ? [{
icon: 'ti ti-code',
}] : []);
definePageMetadata(computed(() => user ? {
definePageMetadata(computed(() => user.value ? {
icon: 'ti ti-user',
title: user.name ? `${user.name} (@${user.username})` : `@${user.username}`,
subtitle: `@${getAcct(user)}`,
userName: user,
avatar: user,
path: `/@${user.username}`,
title: user.value.name ? `${user.value.name} (@${user.value.username})` : `@${user.value.username}`,
subtitle: `@${getAcct(user.value)}`,
userName: user.value,
avatar: user.value,
path: `/@${user.value.username}`,
share: {
title: user.name,
title: user.value.name,
},
} : null));
</script>