diff --git a/src/components/settings/settings.vue b/src/components/settings/settings.vue index cef492f3..a17ef0d9 100644 --- a/src/components/settings/settings.vue +++ b/src/components/settings/settings.vue @@ -92,6 +92,11 @@ {{ $t('settings.reply_link_preview') }} +
  • + + {{ $t('settings.virtual_scrolling') }} + +
  • diff --git a/src/components/timeline/timeline.js b/src/components/timeline/timeline.js index da4ca229..0af09f2b 100644 --- a/src/components/timeline/timeline.js +++ b/src/components/timeline/timeline.js @@ -70,11 +70,14 @@ const Timeline = { pinnedStatusIdsObject () { return keyBy(this.pinnedStatusIds) }, - displayingStatuses () { + statusesToDisplay () { const amount = this.timeline.visibleStatuses.length const min = Math.max(0, this.vScrollIndex - 20) const max = Math.min(amount, this.vScrollIndex + 20) return this.timeline.visibleStatuses.slice(min, max).map(_ => _.id) + }, + virtualScrollingEnabled () { + return this.$store.getters.mergedConfig.virtualScrolling } }, components: { diff --git a/src/components/timeline/timeline.vue b/src/components/timeline/timeline.vue index a406a365..d75fb27c 100644 --- a/src/components/timeline/timeline.vue +++ b/src/components/timeline/timeline.vue @@ -56,7 +56,7 @@ :collapsable="true" :in-profile="inProfile" :profile-user-id="userId" - :virtualHidden="!displayingStatuses.includes(status.id)" + :virtualHidden="virtualScrollingEnabled && !statusesToDisplay.includes(status.id)" /> diff --git a/src/i18n/en.json b/src/i18n/en.json index 75d66b9f..614c867c 100644 --- a/src/i18n/en.json +++ b/src/i18n/en.json @@ -375,6 +375,7 @@ "false": "no", "true": "yes" }, + "virtual_scrolling": "Optimize timeline rendering", "fun": "Fun", "greentext": "Meme arrows", "notifications": "Notifications", diff --git a/src/i18n/fi.json b/src/i18n/fi.json index e7ed5408..563ff2b1 100644 --- a/src/i18n/fi.json +++ b/src/i18n/fi.json @@ -228,7 +228,8 @@ "values": { "false": "pois päältä", "true": "päällä" - } + }, + "virtual_scrolling": "Optimoi aikajanan suorituskykyä" }, "time": { "day": "{0} päivä", diff --git a/src/modules/config.js b/src/modules/config.js index de9f041b..2a91800f 100644 --- a/src/modules/config.js +++ b/src/modules/config.js @@ -49,7 +49,8 @@ export const defaultState = { useContainFit: false, greentext: undefined, // instance default hidePostStats: undefined, // instance default - hideUserStats: undefined // instance default + hideUserStats: undefined, // instance default + virtualScrolling: undefined // instance default } // caching the instance default properties diff --git a/src/modules/instance.js b/src/modules/instance.js index 625323b9..d8560d94 100644 --- a/src/modules/instance.js +++ b/src/modules/instance.js @@ -34,6 +34,7 @@ const defaultState = { showFeaturesPanel: true, minimalScopesMode: false, greentext: false, + virtualScrolling: true, // Nasty stuff pleromaBackend: true,