Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Theme + memo

Manav Rathi985ebc2f7791
diff --git a/web/apps/photos/src/components/SearchBar.tsx b/web/apps/photos/src/components/SearchBar.tsx
index 422a4ba3b9..91cea16887 100644
--- a/web/apps/photos/src/components/SearchBar.tsx
+++ b/web/apps/photos/src/components/SearchBar.tsx
@@ -1,6 +1,7 @@
import { assertionFailed } from "@/base/assert";
import { useIsMobileWidth } from "@/base/hooks";
import { FileType } from "@/media/file-type";
+import { useTheme, type Theme } from "@mui/material";
import {
isMLSupported,
mlStatusSnapshot,
@@ -139,7 +140,9 @@ const SearchInput: React.FC<SearchInputProps> = ({
// The contents of the input field associated with the select.
const [inputValue, setInputValue] = useState("");
- const styles = useSelectStyles();
+ const theme = useTheme();
+
+ const styles = useMemo(() => useSelectStyles(theme), [theme]);
useEffect(() => {
search(value);
@@ -279,8 +282,8 @@ const SearchInputWrapper = styled(Box)`
margin: auto;
`;
-const useSelectStyles = (): StylesConfig<SearchOption, false> => {
- console.log("useSelectStyles");
+const useSelectStyles = (theme: Theme): StylesConfig<SearchOption, false> => {
+ console.log("useSelectStyles", theme);
return {
container: (style) => ({ ...style, flex: 1 }),
control: (style, { isFocused }) => ({
diff --git a/web/apps/photos/src/components/pages/gallery/Avatar.tsx b/web/apps/photos/src/components/pages/gallery/Avatar.tsx
index 7ee9e2f7b5..5d7d5ea8fc 100644
--- a/web/apps/photos/src/components/pages/gallery/Avatar.tsx
+++ b/web/apps/photos/src/components/pages/gallery/Avatar.tsx
@@ -1,7 +1,6 @@
import log from "@/base/log";
import { EnteFile } from "@/new/photos/types/file";
-import { styled } from "@mui/material";
-import { useTheme } from "@mui/material/styles";
+import { styled, useTheme } from "@mui/material";
import { GalleryContext } from "pages/gallery";
import React, { useContext, useLayoutEffect, useState } from "react";