Преглед изворни кода

perf: avoid read localStorage on every render

SukkaW пре 1 година
родитељ
комит
2322851ac4
1 измењених фајлова са 1 додато и 1 уклоњено
  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) {