From e673360087cc993e344ee26880ed6284ccbdb2d6 Mon Sep 17 00:00:00 2001 From: Deluan Date: Sat, 2 Oct 2021 21:39:33 -0400 Subject: [PATCH] Limit number of playlists displayed in the sidebar, to avoid UI freezes --- ui/src/consts.js | 2 ++ ui/src/layout/PlaylistsSubMenu.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/src/consts.js b/ui/src/consts.js index bda543514..101254ec8 100644 --- a/ui/src/consts.js +++ b/ui/src/consts.js @@ -18,3 +18,5 @@ DraggableTypes.ALL.push( DraggableTypes.DISC, DraggableTypes.ARTIST ) + +export const MAX_SIDEBAR_PLAYLISTS = 100 diff --git a/ui/src/layout/PlaylistsSubMenu.js b/ui/src/layout/PlaylistsSubMenu.js index 49d4611be..28c7c8d4f 100644 --- a/ui/src/layout/PlaylistsSubMenu.js +++ b/ui/src/layout/PlaylistsSubMenu.js @@ -13,7 +13,7 @@ import { BiCog } from 'react-icons/all' import { useDrop } from 'react-dnd' import SubMenu from './SubMenu' import { isWritable } from '../common' -import { DraggableTypes } from '../consts' +import { DraggableTypes, MAX_SIDEBAR_PLAYLISTS } from '../consts' const PlaylistMenuItemLink = ({ pls, sidebarIsOpen }) => { const dataProvider = useDataProvider() @@ -56,7 +56,7 @@ const PlaylistsSubMenu = ({ state, setState, sidebarIsOpen, dense }) => { payload: { pagination: { page: 0, - perPage: 0, + perPage: MAX_SIDEBAR_PLAYLISTS, }, sort: { field: 'name' }, },