Skip to content

Commit

Permalink
perf: remove OverlayScrollbars
Browse files Browse the repository at this point in the history
OverlayScrollbars killed the performance of pages with huge DOM manipulations, like library pages (where the scroller is virtual). It also attempted to track events from image objects, which slowed down the app even more.
  • Loading branch information
ThibaultNocchi authored and ferferga committed Jan 26, 2023
1 parent bd9beb1 commit 100c516
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 43 deletions.
4 changes: 2 additions & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en" data-overlayscrollbars-initialize>
<html lang="en">
<head>
<style>
@keyframes gradient {
Expand Down Expand Up @@ -94,7 +94,7 @@
<script type="module" src="src/main.ts"></script>
<title>Jellyfin Vue</title>
</head>
<body data-overlayscrollbars-initialize>
<body>
<div class="splashBackground">
<div class="splashLogo"></div>
</div>
Expand Down
1 change: 0 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"langs": "2.0.0",
"lodash-es": "4.17.21",
"mux.js": "6.1.0",
"overlayscrollbars": "2.0.1",
"screenfull": "6.0.1",
"shaka-player": "4.1.1",
"swiper": "8.3.2",
Expand Down
15 changes: 6 additions & 9 deletions frontend/src/assets/styles/global.scss
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;

/**
* Remove native scrollbars: we're using OverlayScrollbars for that
* That also removes the need for scroll-behaviour: smooth
*/
/* W3C standard scrollbars (Firefox-only for now) */
scrollbar-width: none;
}
/* Reproduce something similar on Chrome/Edge/Safari */

*::-webkit-scrollbar {
display: none;
width: 5px;
}

*::-webkit-scrollbar-thumb {
background: #666;
}

/* Vuetify overrides */
Expand Down
25 changes: 0 additions & 25 deletions frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/

import { createApp } from 'vue';
import { OverlayScrollbars, ClickScrollPlugin } from 'overlayscrollbars';
import Root from '@/App.vue';
/* eslint-disable no-restricted-imports */
import { createRemote, i18n, router, vuetify } from '@/plugins';
Expand All @@ -22,7 +21,6 @@ import { hideDirective } from '@/plugins/directives';
*/
import '@/assets/styles/global.scss';
import '@/assets/styles/transitions.scss';
import 'overlayscrollbars/overlayscrollbars.css';

/**
* - VUE PLUGINS, STORE AND DIRECTIVE -
Expand Down Expand Up @@ -51,31 +49,8 @@ await router.isReady();
* splash screen gets frozen an small (but noticeable) amount of time.
*/
const appDOM = document.querySelector('#app') as HTMLDivElement;
const bodyDOM = document.querySelector('body') as HTMLBodyElement;
const splashDOM = document.querySelector('.splashBackground') as HTMLDivElement;

OverlayScrollbars.plugin(ClickScrollPlugin);
window.setTimeout(() => {
window.requestAnimationFrame(() => {
OverlayScrollbars(
{
target: bodyDOM
},
{
update: {
debounce: 0
},
scrollbars: {
autoHide: 'move',
autoHideDelay: 1000,
clickScroll: true,
dragScroll: true
}
}
);
});
});

/**
* Once we reach this point, the bundle and the app will be completely loaded and mounted,
* so we add a loadFinished class (defined in index.html) that fires the defined transition
Expand Down
6 changes: 0 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 100c516

Please sign in to comment.