delay render of "heavy" tabs

This commit is contained in:
Henry Jameson 2024-12-22 17:11:30 +02:00
parent 7eff56ca2e
commit 375cbca9eb
2 changed files with 11 additions and 1 deletions

View file

@ -17,6 +17,7 @@
:label="$t('settings.appearance')" :label="$t('settings.appearance')"
icon="window-restore" icon="window-restore"
data-tab-name="appearance" data-tab-name="appearance"
:delay-render="true"
> >
<AppearanceTab /> <AppearanceTab />
</div> </div>
@ -25,6 +26,7 @@
:label="$t('settings.style.themes3.editor.title')" :label="$t('settings.style.themes3.editor.title')"
icon="palette" icon="palette"
data-tab-name="style" data-tab-name="style"
:delay-render="true"
> >
<StyleTab /> <StyleTab />
</div> </div>
@ -33,6 +35,7 @@
:label="$t('settings.theme_old')" :label="$t('settings.theme_old')"
icon="paint-brush" icon="paint-brush"
data-tab-name="theme" data-tab-name="theme"
:delay-render="true"
> >
<ThemeTab /> <ThemeTab />
</div> </div>

View file

@ -85,6 +85,7 @@ export default {
setTab (index) { setTab (index) {
if (typeof this.onSwitch === 'function') { if (typeof this.onSwitch === 'function') {
this.onSwitch.call(null, this.slots()[index].key) this.onSwitch.call(null, this.slots()[index].key)
console.log('DEBUG', this.slots()[index])
} }
this.active = index this.active = index
if (this.scrollableTabs) { if (this.scrollableTabs) {
@ -145,7 +146,13 @@ export default {
if (props.fullHeight) { if (props.fullHeight) {
classes.push('full-height') classes.push('full-height')
} }
const renderSlot = (!this.renderOnlyFocused || active) let delayRender = slot.props['delay-render']
if (delayRender && active) {
slot.props['delay-render'] = false
delayRender = false
}
console.log('DEBUG', !delayRender, !this.renderOnlyFocused, active)
const renderSlot = (!delayRender && (!this.renderOnlyFocused || active))
? slot ? slot
: '' : ''