make client component caching configurable

part of bffe6fb9bfa1fe61eab4f03bd318c010644d7afb
This commit is contained in:
syuilo 2022-06-30 03:53:40 +09:00 committed by Johann150
parent 303ce42024
commit 896b3d817e
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
4 changed files with 14 additions and 1 deletions

View file

@ -857,6 +857,8 @@ recentNDays: "直近{n}日"
isSystemAccount: "システムにより自動で作成・管理されているアカウントです。"
typeToConfirm: "この操作を行うには {x} と入力してください"
deleteAccount: "アカウント削除"
numberOfPageCache: "ページキャッシュ数"
numberOfPageCacheDescription: "多くすると利便性が向上しますが、負荷とメモリ使用量が増えます。"
_emailUnavailable:
used: "既に使用されています"

View file

@ -1,5 +1,5 @@
<template>
<KeepAlive max="5">
<KeepAlive :max="defaultStore.state.numberOfPageCache">
<component :is="currentPageComponent" :key="key" v-bind="Object.fromEntries(currentPageProps)"/>
</KeepAlive>
</template>
@ -7,6 +7,7 @@
<script lang="ts" setup>
import { inject, nextTick, onMounted, onUnmounted, watch } from 'vue';
import { Router } from '@/nirax';
import { defaultStore } from '@/store';
const props = defineProps<{
router?: Router;

View file

@ -81,6 +81,10 @@
<option value="force">{{ i18n.ts._nsfw.force }}</option>
</FormSelect>
<FormRange v-model="numberOfPageCache" :min="1" :max="10" :step="1" class="_formBlock">
<template #label>{{ i18n.ts.numberOfPageCache }}</template>
<template #caption>{{ i18n.ts.numberOfPageCacheDescription }}</template>
</FormRange>
<FormLink to="/settings/deck" class="_formBlock">{{ i18n.ts.deck }}</FormLink>
@ -93,6 +97,7 @@ import { computed, ref, watch } from 'vue';
import FormSwitch from '@/components/form/switch.vue';
import FormSelect from '@/components/form/select.vue';
import FormRadios from '@/components/form/radios.vue';
import FormRange from '@/components/form/range.vue';
import FormSection from '@/components/form/section.vue';
import FormLink from '@/components/form/link.vue';
import MkLink from '@/components/link.vue';
@ -132,6 +137,7 @@ const imageNewTab = computed(defaultStore.makeGetterSetter('imageNewTab'));
const nsfw = computed(defaultStore.makeGetterSetter('nsfw'));
const disablePagesScript = computed(defaultStore.makeGetterSetter('disablePagesScript'));
const showFixedPostForm = computed(defaultStore.makeGetterSetter('showFixedPostForm'));
const numberOfPageCache = computed(defaultStore.makeGetterSetter('numberOfPageCache'));
const instanceTicker = computed(defaultStore.makeGetterSetter('instanceTicker'));
const enableInfiniteScroll = computed(defaultStore.makeGetterSetter('enableInfiniteScroll'));
const useReactionPickerForContextMenu = computed(defaultStore.makeGetterSetter('useReactionPickerForContextMenu'));

View file

@ -229,6 +229,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: true,
},
numberOfPageCache: {
where: 'device',
default: 5,
},
aiChanMode: {
where: 'device',
default: false,