More performance updates
This commit is contained in:
@@ -33,11 +33,7 @@ export function Themes() {
|
||||
const allThemes: Theme[] = allThemeData?.filter((a: Theme) =>
|
||||
a.name.toLowerCase().includes((debouncedSearch as string).toLowerCase()),
|
||||
);
|
||||
const {
|
||||
data: backgroundData,
|
||||
isFetched: backgroundDataIsFetched,
|
||||
isFetching: backgroundDataIsFetching,
|
||||
} = useQueryAPI({
|
||||
const { data: backgroundData, isFetching: backgroundDataIsFetching } = useQueryAPI({
|
||||
endpoint: backgroundsEndpoint,
|
||||
});
|
||||
const { data: themePlaylistData } = useQueryAPI({
|
||||
@@ -50,7 +46,9 @@ export function Themes() {
|
||||
backgroundModalOpened,
|
||||
{ open: openBackgroundModal, close: closeBackgroundModal },
|
||||
] = useDisclosure(false);
|
||||
const [backgroundList, setBackgroundList] = useState<string[]>(['None']);
|
||||
const backgroundList = backgroundData
|
||||
? ['None', ...backgroundData.sort((a: string, b: string) => a.localeCompare(b))]
|
||||
: ['None'];
|
||||
const inUseBackgrounds: string[] = [
|
||||
...new Set(
|
||||
allThemes
|
||||
@@ -76,6 +74,7 @@ export function Themes() {
|
||||
textShadowsEnabled: 0,
|
||||
appShadowsEnabled: 0,
|
||||
});
|
||||
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [isNew, setIsNew] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
@@ -93,15 +92,6 @@ export function Themes() {
|
||||
openThemeModal();
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (backgroundData && backgroundDataIsFetched) {
|
||||
setBackgroundList([
|
||||
'None',
|
||||
...backgroundData.sort((a: string, b: string) => a.localeCompare(b)),
|
||||
]);
|
||||
}
|
||||
}, [backgroundData, backgroundDataIsFetched]);
|
||||
|
||||
useEffect(() => {
|
||||
if (debouncedSearch === searchValue) {
|
||||
setIsLoading(false);
|
||||
|
||||
Reference in New Issue
Block a user