Ver Fonte

perf: avoid read localStorage on every render

SukkaW há 1 ano atrás
pai
commit
2322851ac4
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      app/components/mask.tsx

+ 1 - 1
app/components/mask.tsx

@@ -405,7 +405,7 @@ export function MaskPage() {
   const chatStore = useChatStore();
 
   const [filterLang, setFilterLang] = useState<Lang | undefined>(
-    localStorage.getItem("Mask-language") as Lang | undefined,
+    () => localStorage.getItem("Mask-language") as Lang | undefined,
   );
   useEffect(() => {
     if (filterLang) {